Java Interview Questions
Basic Level Java Interview Questions
- What is Java?
- What are the features of Java?
- What is the difference between JDK, JRE, and JVM?
- What is a class and object in Java?
- What is the difference between method overloading and method overriding?
- What is inheritance in Java?
- What are access modifiers in Java?
- What is the difference between == and .equals()?
- What is a constructor? Types?
- What is the difference between static and non-static methods?
OOPs Concepts in Java (Frequently Asked)
- Explain the 4 pillars of OOPs (Abstraction, Encapsulation, Inheritance, Polymorphism).
- What is abstraction? How is it implemented in Java?
- What is interface and how is it different from abstract class?
- What is encapsulation and its real-life example in Java?
Intermediate to Advanced Java Questions
- What is exception handling? Explain try-catch-finally.
- What is the difference between checked and unchecked exceptions?
- What is multithreading in Java?
- Explain the use of synchronized keyword.
- What is the difference between ArrayList and LinkedList?
- What is the difference between HashMap and Hashtable?
- What are Wrapper classes in Java?
- What is the difference between String, StringBuffer, and StringBuilder?
- What is the Collection Framework in Java?
- What is garbage collection in Java? How does it work?
Practical & Coding Questions
- Write a Java program to check if a number is prime.
- Write a program to reverse a string.
- Write a program to find the factorial of a number.
- Write a program to implement a simple calculator.
- Write a program to sort an array.
Java 8+ Features (For Experienced)
- What are Lambda expressions?
- What is a Functional Interface?
- What is Stream API and how is it used?
- What are default and static methods in interfaces?
- What is Optional class in Java 8?