When it comes to saving data, available formats fall in two large categories:
- Text formats (such as simple text files, source code files, XML, etc), which have the advantages of being human readable and editable with simple tools, but they can only be parsed by complicated programs (the more complicated the language, the more complicated the program must be to actually understand it).
- Binary formats (such as most image formats, wave sounds, executables, bytecode files), which have the advantages of being smaller in size for the same amount of information and they don't need a complicated parser to be understood by the machine (often the data is stored in fixed-size chunks, which makes parsing them even easier).
A .class
file is primarily intended to be fed to the JVM, so it should be in the smallest and easiest-to-read possible format for the machine. If the .class
file was a text file (if the bytecode was saved in its human-readable form), parsing would be required every time the .class
file is loaded. However, this feature isn't often needed, so it would be a waste of the application's loading time to do that.