1 · Foundations · lesson 1 of 41

What is Java & the JVM?

Write once, run anywhere — how bytecode and the JVM make it possible.

Java is a statically typed, object-oriented language that compiles to platform-neutral bytecode. The Java Virtual Machine (JVM) loads that bytecode and executes it on any operating system.

The lifecycle: your .java source is compiled by javac into a .class file of bytecode. The JVM's class loader pulls those classes into memory, the bytecode verifier checks them, and the execution engine (interpreter + JIT compiler) runs them — turning hot code paths into optimized native machine code at runtime.

The pipeline in one line
Hello.java  →  javac  →  Hello.class  →  JVM  →  native CPU
TIP
Rotate the 3D JVM below to see the ClassLoader, Runtime Data Areas and Execution Engine as separate stages that data flows through.
Loading 3D scene…
Key takeaways
  • ✓Java source compiles to bytecode, not to a specific CPU.
  • ✓The JVM is the portable runtime; different JVMs exist for different OSes.
  • ✓The JIT compiler turns hot methods into fast native code while the program runs.