I CSI 201 Chapter Notes - Chapter 2: Newline, Semicolon, Filename Extension
Document Summary
A java source code file contains one or more java classes. If more than one class is in a source code file, only one of them may be. The public class and the filename of the source code file must match. ex: a class named simple must be in a file named simple. java. Each java class can be separated into parts. This will result in a file named simple. class being created. The java command assumes the extension is . class. The comment in the example is a single-line comment. The class header tells the compiler things about the class such as what other classes can use it (public) and that it is a java class (class), and the name of that class (simple). When associated with the class header, they define the scope of the class. When associated with a method, they define the scope of the method.