Java language is strictly case sensitive
Multiple classes can be defined in a Java source file, but only one of the classes is defined as the public class
If the source file contains the public class, the name of the source file must be the same as the public class
public class Test{public static void Main (string[] args) {System.out.println ("Hello world!");}}
Compile
If the name is inconsistent, the error will be
When a source file contains multiple classes, a successful compilation generates a corresponding number of bytecode files, that is, each class generates a separate class file, and the byte-code file name is the same as its corresponding class name
public class Test{public static void Main (string[] args) {System.out.println ("Hello world!");}} Class A{}class B{}class c{}
Compile
If a class must run, you must have the main method, because the main method is the primary entry of the program
Programming Recommendations:
A Java source file defines only one class, and different classes use different source file definitions
Defines the individually defined classes in each source file as public
Keep the Java source file name consistent with the class name in the source file
Basic syntax for Java