Difficulty: Easy
Correct Answer: Incorrect
Explanation:
Introduction / Context:
Java compiles source into bytecode stored in .class files. The core promise is “write once, run anywhere,” relying on a platform-specific JVM to execute the same bytecode across architectures.
Given Data / Assumptions:
Concept / Approach:
Machine-specific code is native binary tied to an instruction set. Bytecode is an intermediate, machine-independent representation interpreted/JIT-compiled by the JVM at runtime to the host architecture.
Step-by-Step Solution:
Compile Hello.java to Hello.class.Copy to Windows, Linux, macOS.Run with their respective JVMs; observe identical behavior.Note no recompilation is required.Understand JIT produces machine-specific native code at runtime, not at compile time.
Verification / Alternative check:
Run the same JAR across platforms; bytecode remains unchanged.
Why Other Options Are Wrong:
It is not “correct for x86” or “Android only”; the concept is VM portability.
Common Pitfalls:
Confusing bytecode with native binaries; assuming portability implies identical performance.
Final Answer:
Incorrect
Discussion & Comments