What is the file extension for compiled Java bytecode?
Answer
.class
Answer
.class
The file extension for compiled Java bytecode is `.class`.
The Java compiler, traditionally invoked as `javac`, translates a `.java` source file into one or more class files. Each class file contains JVM bytecode plus structural metadata such as the class name, superclass, fields, methods, constant pool, and version information. The Java Virtual Machine loads and verifies these files before interpreting or just-in-time compiling their instructions.
The `.class` format helped make Java’s “write once, run anywhere” model practical: the same platform-independent bytecode can run on different operating systems when a compatible JVM is available. A class file begins with the distinctive hexadecimal magic number `CAFEBABE`, another useful clue when inspecting compiled output.
`.java` is the human-readable source extension, while `.jar` is an archive format that can package many `.class` files along with resources and metadata. Inner and anonymous classes may produce additional `.class` files whose names contain `$`, so one source file does not always map to exactly one compiled file. Other JVM languages, including Kotlin and Scala, can also emit `.class` files.
Source: Wikipedia · fact-checked Aug. 2026