System.out.println (); Print the text inside to change-line.
System.out.print (); No Line break printing
Error reason analysis:
The compiler prompts class A to be public and should declare an error in a file named A.java.
First Kind
"Class A is public and should be declared in a file named A.java" This sentence needs to be understood in two steps:
1. If Class A is declared public, then class A must be stored in a file named A.java, and the class name should be the same as the file name;
2, conversely, a file contains a maximum of a top-level public class, and the public class name is the same as the file name. For example, in file A.java, one or more classes are allowed to be defined, but at most a top-level public class is allowed, and this class is named A. The top-level emphasis here means allowing non-top-level public classes to exist, such as internal public classes.
The second Kind
This is your naming error. Change the file name to A.java because the class inside you is public class a{} either you get rid of your common (pubic) or you want to keep the class name consistent
Third Kind
There can be at most one class in a file that is public, so you can expose the definition of a class to be accessible to other classes! If you already have this common class, then this file name must be the same as the class name!
Also note that if you have only built a Java file, public can only declare before public static void main, or even if the class name of the public you have defined is the same as the name of the Java file you declared, it can only be in vain.
Java Beginner Knowledge points