beginnerJava Fundamentals

Why is Java called a platform-independent language?

Java source code compiles to bytecode, not native machine code — that bytecode runs unchanged on any device with a compatible JVM, since the JVM (not the OS) is what actually translates it into native instructions. "Write once, run anywhere" refers to the bytecode being portable, not the JVM itself, which is platform-specific.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to What are anonymous inner classes in Java, and what are their restrictions compared to named classes?← Back to all Core Java questions