JVM architecture, bytecode, class loading, heap and stack, garbage collector types, JIT compilation and common tuning flags.
39 cards · basic cards · AI-written, checked twice. Edit anything.
- What is the Java Virtual Machine (JVM)?
Show answer
Software that executes compiled Java bytecode, providing platform independence and runtime services like memory management
- What does the javac tool do?
Show answer
Compiles Java source code (.java files) into platform-independent bytecode (.class files)
- What is Java bytecode?
Show answer
Compiled intermediate code that is platform-independent and executed by the JVM, typically stored in .class files
- Why is Java bytecode platform-independent?
Show answer
Bytecode is the same regardless of OS or CPU, and the JVM on each platform translates it to native machine code
- Name the three phases of class loading
Show answer
Loading (read bytecode), linking (verify, prepare, resolve), initialization (execute static blocks)
- What is the bootstrap class loader?
Show answer
Loads core Java classes from the JDK (java.lang, java.util, etc) from JAVA_HOME/lib
- What is the application class loader?
Show answer
Loads user-defined classes and application classes from the classpath
- What is bytecode verification?
Show answer
During class linking, the bytecode verifier checks for illegal operations, type mismatches, and security violations
- What is the heap in JVM memory?
Show answer
Shared memory region where all objects are dynamically allocated, managed by the garbage collector
- What is the stack in JVM memory?
Show answer
Per-thread memory region that stores method call frames containing local variables, primitive values, and object references
- How is stack memory reclaimed?
Show answer
Automatically when a method returns and its frame is popped off the stack
- What is StackOverflowError?
Show answer
Thrown when a thread exhausts its stack memory, typically from infinite recursion or very deep call stacks
- What is OutOfMemoryError?
Show answer
Thrown when the heap is full and the garbage collector cannot free enough memory for a new object allocation
- What is the young generation?
Show answer
Part of the heap where newly created objects are allocated, collected frequently by minor garbage collection
- What is the old generation?
Show answer
Part of the heap where long-lived objects that survive young generation collections are promoted