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:
Programming fundamentals
- Question: What is difference between object-oriented programming and functional programming?
Answer: Following pages present good perspective on the differences:
http://stackoverflow.com/questions/6720348/difference-between-oop-and-functional-programming-scheme
http://c2.com/cgi/wiki?OoVsFunctional
Java Objects
- Question: What is difference between comparing two objects using equals method and “==” operator?
Answer: http://stackoverflow.com/questions/5848370/equals-and-operator-in-java - Question: What is the significance of equals and hash method in Object class?
Answer: http://www.javaworld.com/article/2074996/hashcode-and-equals-method-in-java-object—a-pragmatic-concept.html
Collections
- Question: What is difference between LinkedList and ArrayList? When would you want to use one and not the other?
Answer: http://javarevisited.blogspot.in/2012/02/difference-between-linkedlist-vs.html - 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:
http://stackoverflow.com/questions/1035008/what-is-the-difference-between-set-and-list
Exception Handling
- 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
http://vitalflux.com/6-java-exceptions-haunts-newbie-java-developer/
Others
- Question: What is difference between the keyword, transient and volatile? Is it like comparing apple and orange?
Answer: http://javarevisited.blogspot.in/2012/03/difference-between-transient-and.html - Question: What is difference between the keyword, final, finally and finalize?
Answer: http://stackoverflow.com/questions/7814688/in-java-what-purpose-do-the-keywords-final-finally-and-finalize-fulfil - 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:
http://www.cs.rit.edu/~tmh/courses/allJava/Anonymous.html
[adsenseyu1]
Latest posts by Ajitesh Kumar (see all)
- Agentic Reasoning Design Patterns in AI: Examples - October 18, 2024
- LLMs for Adaptive Learning & Personalized Education - October 8, 2024
- Sparse Mixture of Experts (MoE) Models: Examples - October 6, 2024
Check for Java interview questions to online practice @ http://skillgun.com
Thanks…i visited one blog also explained good please go through this blog http://adnjavainterview.blogspot.in/2014/06/exception-handling-questions.html