Witscale Test Center

8.1 Java source file


8.1 Java source file

All java source files are text files. They must have the .java extension. A source file contains class definitions along with appropriate package declaration and import statements. There are certain simple rules on the structure of a java source file and the class declarations within it. The next sections examine them one by one.

 

The .java extension is not the requirement specified by Java language. However, most implementations of Java compiler require that the source file name must have a .java extension.