JAVA INTERVIEW QUESTIONS
1. What is the difference between abstraction and encapsulation, and how are they implemented
in Java?
2. How does inheritance work in Java and what are its limitations?
3. What are ConcurrentHashMap internals (bucket, segment, etc.)?
4. What are functional interfaces? Give examples from Java’s standard library?
5. How would you identify and fix a memory leak in a Java application?
6. What are the pros and cons of using LinkedList over ArrayList?
7. Explain common design patterns (Singleton, Factory, Builder, Strategy)?
8. When to use interface vs abstract class?
9. What is the Java Memory Model (JMM)? How does volatile work under it?
10. How does ExecutorService work, and what are its advantages over traditional threads?
11. What is the purpose of method references and how are they different from lambda
expressions?
12. What are the differences between final, finally, and finalize() in Java?
13. How does exception handling affect method overriding (throws clause)?
14. How would you implement a custom collector in the Stream API?
15. Explain different garbage collectors and when to use them?
16. How does GC tuning affect application performance?
17. What tools are available for heap dump analysis?
18. How does JDBC handle transactions?
19. How does memory-mapped file I/O work?
20. Explain the Stream API – benefits, limitations, and use cases?
21. How do you handle exceptions in production?
22. How do you create a thread in Java?
23. What is the difference between intermediate and terminal operations in Java Streams?
24. Explain the difference between synchronized blocks and ReentrantLock?
25. What’s the difference between byte and character streams?
26. Explain Dependency Injection and how it's achieved in Java?
27. How does synchronization work? What are intrinsic locks?
28. What are the SOLID principles in OOP? Can you apply them in Java?
29. How does Java manage memory? What is the role of the heap and stack?
30. What are weak references and how are they used?