Advanced Java Interview Questions: JVM, GC, Concurrency, and More

Core Java interview questions with only advanced questions (no basics) 👇 1. How does JVM memory model work (Heap, Metaspace, Stack, PC, Native)? 2. Explain GC algorithms: G1 vs ZGC vs CMS – when to use what? 3. What is the hashCode()–equals() contract and how does it affect HashMap? 4. How does ConcurrentHashMap achieve thread-safety internally? 5. Difference between synchronized, ReentrantLock, and StampedLock? 6. What happens internally during a thread context switch? 7. Explain Java Memory Model (JMM) and the volatile keyword. 8. How does CompletableFuture work compared to Future? 9. Internal working of Java Streams – lazy evaluation & short-circuiting. 10. How does Optional help in avoiding NPE and when not to use it? 11. Type erasure in Generics – limitations and runtime impact. 12. Reflection: performance cost and real-world use cases. 13. Serialization vs Externalization – differences and risks. 14. JDBC connection pooling – why and how it improves performance? 15. How does Spring use Dependency Injection at runtime? 16. Singleton implementation pitfalls in multithreaded environments. 17. Factory vs Abstract Factory – real backend use case? 18. How does Java handle OutOfMemoryError and GC tuning? 19. Stack vs Heap memory – impact on performance and scalability. 20. How do you debug a production memory leak in Java? Skipping basics. Focusing on real interview questions. #Java #CoreJava #InterviewPrep #Backend #SoftwareEngineer

To view or add a comment, sign in

Explore content categories