Bytecode
A free lesson from Swipe Coding · Java, level 1 · updated October 2026
By the Swipe team, founded by Colin · how we make lessons
When the compiler ("javac") translates your source code, the result is not a finished file for Windows, macOS, or Linux — but "bytecode". Bytecode is an intermediate form: no longer human-readable text, but also not machine language for a specific processor.
Bytecode is saved in a new file with the extension ".class". So after compiling, "Main.java" becomes "Main.class".
javac Main.java // produces: Main.class
Bytecode files in Java have the file extension ____.
What is special about bytecode is that it is platform-independent. This means the same .class file can be used on a Windows PC, a Mac, or a Linux server — the bytecode itself is identical everywhere. No recompiling needed for each operating system!
Bytecode is different for each operating system and must be freshly generated for Windows, macOS, and Linux.
Bytecode still isn't what the processor directly understands, though. It is a kind of "intermediate language", made specifically to be read by another program — the Java Virtual Machine (JVM), which you will learn about in the next lesson. It is exactly this combination of bytecode and JVM that makes Java's motto "Write once, run anywhere" possible.
Why is bytecode so important for Java?
In summary: source code (.java) is translated by the compiler into bytecode (.class). Bytecode is not yet machine language, but a platform-independent intermediate form waiting to be executed.
Bytecode is created when the compiler translates a .java file.
Keep your streak going in Swipe Coding
Swipe through every level of Java on your iPhone — with XP, stars, streaks, a personal advisor and the full track beyond these free levels.
Get the Swipe apps →