Top 25 Java Coding Interview Questions with Answers (2025 Edition)
1. What is the difference between JDK, JRE, and JVM?
JDK (Java Development Kit) is a software development environment.
JRE (Java Runtime Environment) provides libraries and JVM.
JVM (Java Virtual Machine) runs Java bytecode on any platform.
2. What are the main features of Java?
Object-oriented, Platform-independent, Secure, Robust, Portable, Multithreaded.
3. What is the difference between '==' and '.equals()' in Java?
'==' checks reference equality (memory address), while '.equals()' checks object value equality.
4. What is a constructor in Java?
A constructor is a special method used to initialize objects. It has the same name as the class.
5. What is method overloading and method overriding?
Overloading: Same method name with different parameters in the same class.
Overriding: Subclass provides specific implementation of a method already defined in its parent
class.
6. What is the difference between ArrayList and LinkedList in Java?
ArrayList uses dynamic arrays and offers fast random access.
LinkedList uses doubly linked lists and is better for frequent insertions/deletions.
7. What is a static keyword in Java?
'static' means the member belongs to the class rather than an instance. Useful for methods,
variables, and blocks.
8. What are access modifiers in Java?
Access modifiers define visibility: public, private, protected, and default (no modifier).
9. What is the difference between final, finally, and finalize?
'final' is a keyword to make variables/constants.
'finally' is a block that executes after try-catch.
'finalize()' is a method called by the garbage collector before object destruction.
10. What is multithreading in Java?
Multithreading is a process of executing multiple threads simultaneously.
It helps in maximum CPU utilization. Java provides Thread class and Runnable interface.