nerdexam
Oracle

1Z0-811 · Question #57

What is the meaning of "write once, run anywhere" in Java?

The correct answer is C. Java programs can run on any Java Virtual Machine without being recompiled. "Write once, run anywhere" (WORA) is Java's core portability promise: you compile Java source code once into bytecode (.class files), and that bytecode runs on any platform that has a JVM - Windows, macOS, Linux - without recompilation. The JVM acts as the platform-specific…

Java Basics

Question

What is the meaning of "write once, run anywhere" in Java?

Options

  • AJava programs are designed to run only in web browsers and, thus, can run wherever there is a browser.
  • BIt is a marketing statement because Java programs must be compiled for a specific platform in order to run.
  • CJava programs can run on any Java Virtual Machine without being recompiled.
  • DJava programs, after being compiled, can run on any platform or device even without a Java Virtual Machine.

How the community answered

(42 responses)
  • B
    5% (2)
  • C
    93% (39)
  • D
    2% (1)

Explanation

"Write once, run anywhere" (WORA) is Java's core portability promise: you compile Java source code once into bytecode (.class files), and that bytecode runs on any platform that has a JVM - Windows, macOS, Linux - without recompilation. The JVM acts as the platform-specific translator, so you write to the JVM's specification, not to any particular OS.

Why the distractors are wrong:

  • A is wrong because Java runs on any JVM-equipped device, not just browsers - desktop apps, servers, and Android all run Java without a browser.
  • B is wrong because it contradicts WORA entirely; the whole point is that you don't compile per-platform - the JVM handles that abstraction.
  • D is wrong because it inverts the requirement: you absolutely need a JVM - it's the middleman that makes cross-platform execution possible.

Memory tip: Think of the JVM as a universal adapter plug - your device (bytecode) stays the same, and the adapter (JVM) handles whatever wall socket (OS/hardware) you're in. WORA = bytecode travels, JVM stays local.

Topics

#JVM#Platform Independence#Bytecode#WORA

Community Discussion

No community discussion yet for this question.

Full 1Z0-811 Practice