Difficulty: Easy
Correct Answer: Java virtual machine
Explanation:
Introduction / Context:
Java compiles source code (.java) into platform-neutral bytecode (.class). This bytecode is executed by a runtime environment that provides memory management, class loading, and just-in-time compilation, enabling “write once, run anywhere.”
Given Data / Assumptions:
Concept / Approach:
The Java Virtual Machine (JVM) is the runtime that loads class files, verifies bytecode safety, manages memory (heap/stack/GC), and executes the program. The Java compiler (javac) is needed at build time, not runtime. Bytecode is the artifact, not a program you “run” directly without the JVM. A web browser is optional and relevant only for legacy applets (now deprecated).
Step-by-Step Solution:
Verification / Alternative check:
Attempt to run a class file without a JVM; the OS cannot execute it natively. With the JVM installed, the java MainClass command runs successfully.
Why Other Options Are Wrong:
Java compiler: for compilation, not execution.
Java bytecode: is the program representation, not an executable environment.
Web browser: unrelated except for obsolete applet technology.
Common Pitfalls:
Confusing JRE (runtime only) with JDK (runtime + compiler/tools); assuming native execution without a JVM.
Final Answer:
Java virtual machine
Discussion & Comments