Difficulty: Easy
Correct Answer: Valid (Java source compiles to bytecode executed by the JVM)
Explanation:
Introduction / Context:
Java’s “write once, run anywhere” promise originates from compiling source code into a platform-neutral intermediate form called bytecode. This bytecode executes on any compatible Java Virtual Machine (JVM), enabling broad portability across operating systems and hardware.
Given Data / Assumptions:
Concept / Approach:
The javac compiler converts .java files into .class files containing JVM bytecode. The JVM loads these classes, verifies them, and executes them using interpretation and/or just-in-time compilation. While newer technologies can compile Java to native binaries, the canonical model remains bytecode to JVM execution, which underpins Java’s portability and security model.
Step-by-Step Solution:
Verification / Alternative check:
Inspect compiled output: .class files contain bytecode; tools like javap display bytecode instructions, confirming the compilation target.
Why Other Options Are Wrong:
Common Pitfalls:
Confusing JVM bytecode with CPU-specific machine code; assuming Android uses standard JVM bytecode (Android uses DEX/ART but the principle of intermediate bytecode remains similar).
Final Answer:
Valid (Java source compiles to bytecode executed by the JVM)
Discussion & Comments