The article (first in the series) aims to present some tricky interview Java questions that could help you score high in your next Java interviews:
- Question: What is difference between object-oriented programming and functional programming?
Answer: Following pages present good perspective on the differences:
- Question: What is difference between comparing two objects using equals method and “==” operator?
- Question: What is the significance of equals and hash method in Object class?
- Question: What is difference between LinkedList and ArrayList? When would you want to use one and not the other?
- Question: How come you keep on adding objects in an ArrayList using add method and no exception is ever thrown? Could you think about underlying code?
Answer: Take a look at the pictures below. The magic happens in the ensureCapacity method where a new arrayList is created, the elements from old arraylist is copied to new one and reference of new arraylist is assigned to member variable (elementData).
- Question: What is difference between a Set and a List?
Answer: The primary difference is that Set is a collection that consists of no duplicate elements or, in other words, consists of all unique elements. Read further on the following page:
- Question: What is difference between ClassNotFoundException and NoClassDefFoundError?
Answer: These are some of the most common exceptions that haunts rookie engineers quite a lot. Check following pages to read the details:http://javarevisited.blogspot.in/2011/07/classnotfoundexception-vs.html
- Question: What is difference between the keyword, transient and volatile? Is it like comparing apple and orange?
- Question: What is difference between the keyword, final, finally and finalize?
- Question: Why anonymous class?
Answer: Following pages presents some good perspectives on anonymous class which remains unused by Java developers for many years primarily due to lack of understanding:
Latest posts by Ajitesh Kumar (see all)
- Mean Squared Error or R-Squared – Which one to use? - September 30, 2020
- Linear Regression Explained with Python Examples - September 30, 2020
- Correlation Concepts, Matrix & Heatmap using Seaborn - September 29, 2020