0% found this document useful (0 votes)
7 views2 pages

Essential Java Interview Questions

The document outlines key Java interview questions and their concise answers, covering essential features of Java, OOP principles, and differences between core concepts like JVM, JDK, and JRE. It also explains method overloading vs. overriding, the distinction between == and equals(), and details about constructors and the Java Collections Framework. Additionally, it compares ArrayList and LinkedList in terms of performance and structure.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Essential Java Interview Questions

The document outlines key Java interview questions and their concise answers, covering essential features of Java, OOP principles, and differences between core concepts like JVM, JDK, and JRE. It also explains method overloading vs. overriding, the distinction between == and equals(), and details about constructors and the Java Collections Framework. Additionally, it compares ArrayList and LinkedList in terms of performance and structure.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Top Java Interview Questions (With Short Answers)

1. What are the main features of Java?

 Object-oriented
 Platform-independent (JVM)
 Robust & secure
 Multithreaded
 Automatic memory management (Garbage Collection)
 Rich standard library

2. Explain the OOP principles.

 Encapsulation — Wrapping data + methods


 Inheritance — Reusing parent properties
 Polymorphism — Many forms (overloading/overriding)
 Abstraction — Showing essential details only

3. What is JVM, JDK, JRE?

 JVM → Runs Java bytecode


 JDK → JRE + development tools (compiler, debugger)
 JRE → JVM + libraries to run Java applications

4. What is the difference between abstract class and interface?


Abstract Class Interface

Can have abstract + concrete methods Only abstract methods (Java 8+ allows default & static methods)

Can have constructors No constructors

Supports single inheritance Supports multiple inheritance

5. What is method overloading and overriding?

 Overloading → Same method name, different parameters (compile-time polymorphism).


 Overriding → Child class modifies parent method (runtime polymorphism).
6. What is the difference between == and equals()?

 == → Compares memory reference


 equals() → Compares object values (can be overridden)

7. What is a constructor?

Special method invoked when an object is created.


Used to initialize object state.
Types: default, parameterized, copy constructor (manually defined).

8. What is the difference between final, finally, and finalize()?

 final → Keyword (constant, non-overridable, non-inheritable)


 finally → Block always executed in try-catch
 finalize() → Method called by GC before object deletion (deprecated)

9. What is the Java Collections Framework?

A set of classes/interfaces for storing data:

 List (ArrayList, LinkedList)


 Set (HashSet, TreeSet)
 Map (HashMap, TreeMap)
 Queue, Deque

10. Difference between ArrayList and LinkedList?


ArrayList LinkedList

Dynamic array Doubly-linked list

Fast random access Fast insert/delete

Slow insert/delete Slow random access

You might also like