Java Interview Cheat Sheet (1 Page)
1) Java in One Line
Java is a high-level, object-oriented, platform-independent language used for desktop, web, mobile, and enterprise apps.
2) JDK, JRE, JVM
• JDK = JRE + dev tools (javac, java, javadoc, debugger).
• JRE = JVM + standard libraries to run apps (from Java 11, bundled within JDK).
• JVM executes bytecode → native machine code (JVM is platform dependent; bytecode is platform independent). 3)
Compilation → Execution
• Compilation (javac): .java → .class (bytecode); syntax + semantic checks.
• Execution (JRE/JVM): Class Loader → Bytecode Verifier → Memory → Execution Engine (Interpreter + JIT). 4) Class
Loader
Parent Delegation Model.
• Bootstrap → core classes (java.*).
• Platform/Extension → lib/ext or modules.
• Application → classpath classes. 5) JVM Memory Model
• Method Area / Metaspace: class metadata, method code, static vars, constant pool.
• Heap: all objects (GC runs here).
• Stack: per-thread frames, local vars, references.
• PC Register: current instruction per thread.
• Native Method Stack: JNI calls (C/C++). 6) Garbage Collection (GC)
• GC is a process on the Heap, not a memory area.
• Objects become eligible when unreachable; [Link]() is only a hint.
• Runs automatically based on memory pressure/heuristics. 7) Execution Engine
• Interpreter: line-by-line, quick startup.
• JIT: compiles hot code to optimized native; boosts performance. 8) Java Class Library (JCL)
Core APIs ([Link], [Link], [Link], ...). Comes with JRE (hence with JDK). Enables portability & productivity. 9)
High-Impact One-Liners
• "Bytecode is platform independent; JVM is platform dependent."
• "ClassLoader loads classes; Metaspace stores metadata; Heap stores objects; Stack stores frames."
• "GC runs on the Heap when the JVM decides—not immediately after null/new."
• "Interpreter starts fast; JIT optimizes hot paths."
• ".class is like a DVD; JVM is the player for each OS/CPU."
© Cheat Sheet – Prepared for interview quick recall