Lesson 1: Introduction to Java & the JVM

02 Jul 2026 1 min Swarnil Singhai

Java compiles to bytecode that runs on the JVM, which is why the same .class file runs on Windows, Linux, or a bank's mainframe unchanged.

Real-time example

Think of a payments company shipping one build to every server in every country instead of compiling per-OS — that's 'write once, run anywhere' in practice.

public class HelloBank {
    public static void main(String[] args) {
        System.out.println("Payment gateway starting...");
    }
}
// javac HelloBank.java  -> HelloBank.class (bytecode)
// java HelloBank         -> runs on any JVM

What's happening

javac compiles source to portable bytecode; java launches the JVM, which interprets/JIT-compiles that bytecode for the host machine.

The JVM is the whole reason Java survived 30 years of hardware churn — the language barely changed, the runtime absorbed the churn.

Advertisement