JVM Interview Questions
JVM Memory Structure
1. How is the JVM memory area divided?
2. What’s the difference between heap and stack?
3. What is the method area? What’s the difference between metaspace and permanent generation?
4. What is the program counter?
5. What is the JVM stack? What does a stack frame contain?
6. What is the native method stack?
7. What is direct memory?
Garbage Collection
8. What is garbage collection?
9. How to determine if an object can be garbage collected?
10. What are GC Roots? Which objects can be GC Roots?
11. What is reference counting? What are its drawbacks?
12. What is the reachability analysis algorithm?
13. What types of references are there in Java?
14. What’s the difference between strong, soft, weak, and phantom references?
Garbage Collection Algorithms
15. How does the Mark-Sweep algorithm work? Pros and cons?
16. How does the Mark-Copy algorithm work? Pros and cons?
17. How does the Mark-Compact algorithm work? Pros and cons?
18. What is generational collection?
19. What garbage collection algorithms are used for young and old generations?
20. What’s the difference between Minor GC, Major GC and Full GC?
Garbage Collectors
21. What are the common garbage collectors?
22. What are the characteristics of the Serial garbage collector?
23. What are the characteristics of the ParNew garbage collector?
24. What are the characteristics of the Parallel Scavenge garbage collector?
25. How does the CMS garbage collector work? Pros and cons?
26. How does the G1 garbage collector work? Pros and cons?
27. What are the characteristics of ZGC and Shenandoah GC?
28. How to choose an appropriate garbage collector?
Class Loading
29. What is the class loading process?
30. What is the parent delegation model? Why use it?
31. How to break the parent delegation model?
32. What are class loaders? What types of class loaders exist?
33. What is a custom class loader? How to implement one?
Performance Tuning
34. What are common JVM parameters?
35. How to analyze GC logs?
36. What is a memory leak? How to troubleshoot?
37. What is a memory overflow? What are common memory overflows?
38. How to troubleshoot OOM issues?
39. What are common JVM diagnostic tools?
40. What are the purposes of jmap, jstat, jstack, and jinfo?
Last updated on