Computer code

Bytecode, Java, and you

DEADBEEF, CAFEBABE...

Animation

source code
javac
*.class
JVM
machine code
CPU

In short

  1. You first write source code, which is human-readable code.
  2. You use a compiler (javac) to turn the source code into Java bytecode.
  3. A process virtual machine (JVM) executes machine code.

HotSpot

OpenJDK's JVM, HotSpot, is neat because it detects "hot spots" of the bytecode and compiles these sections into machine code, speeding up execution.

CAFEBABE

The bytes 0xCAFEBABE is the magic number denoting the start of every bytecode class file.

What languages do this?