A java source file (.java
) holds human-readable text, as opposed to machine-readable binary (.class
files).
If these source files hold plain text, what is the difference between .java
files and .txt
files? Why does java use its own file type for source code rather than .txt
files?
There can be many text file formats, just as there are many binary file formats. Using separate extensions makes them easy to differentiate, especially for the operating system (display icon, open with, etc.).