Difficulty: Easy
Correct Answer: Correct
Explanation:
Introduction / Context:
The JVM executes Java bytecode. Historically, interpretation was the baseline; modern JVMs add Just-In-Time compilation and adaptive optimizations. Still, conceptually, the JVM reads bytecode instructions and executes them at runtime.
Given Data / Assumptions:
Concept / Approach:
Differentiate between interpretation (directly executing bytecode) and JIT (translating hot paths into native code). Both occur at runtime under the JVM’s control, so the statement is essentially correct from a high-level perspective.
Step-by-Step Solution:
Class loading and verification.Interpreter executes methods initially.Profiler detects hot spots.JIT compiles hot code to native and inlines/optimizes.Garbage collector manages memory during execution.
Verification / Alternative check:
Use JVM flags to view compilation logs; observe both interpreted and compiled phases.
Why Other Options Are Wrong:
Limiting correctness to specific versions or editions ignores the general runtime model.
Common Pitfalls:
Assuming “interpreted” means “slow” without JIT consideration; confusing AOT/JIT trade-offs.
Final Answer:
Correct
Discussion & Comments