This wave of rapid learning is mainly to cope with the school recruit Pen interview, the utilitarian nature is unavoidable.
Learning website:
Http://www.runoob.com/java/java-tutorial.html
To perform a command resolution:
Above we used two commands Javac and Java.
The javac command is used to compile the Java source file into a class bytecode file, such as: Javac Helloworld.java.
After running the Javac command, a helloworld.class file appears if there is no error in compiling successfully.
Java commands can run a class bytecode file, such as Java HelloWorld.
Note : Do not Add. class after the Java command.
Variable type:
- Local Variables : variables defined in a method, construction method, or block of statements are called local variables. Both the Declaration and initialization of variables are in the method, and the variables are automatically destroyed when the method ends.
- member variables: member variables are variables that are defined in the class, outside the method body. This variable is instantiated when the object is created. Member variables can be accessed by methods, construction methods, and statement blocks of specific classes within a class.
- Class variables : Class variables are also declared in the class, outside the method body, but must be declared as static types.
source file claim rules
In the final part of this section, we will learn the claim rules for the source file. When you define multiple classes in one source file, and you also have import statements and package statements, pay particular attention to these rules.
- There can be only one public class in a source file
- A source file can have multiple non-public classes
- The name of the source file should be consistent with the class name of the public class. For example: The class name of the public class in the source file is employee, then the source file should be named Employee.java.
- If a class is defined in a package, then the packages statement should be in the first row of the source file.
- If the source file contains an import statement, it should be placed between the package statement and the class definition. If there is no package statement, the import statement should be first in the source file.
- The import statement and the package statement are valid for all classes defined in the source file. In the same source file, you cannot give different package declarations to different classes.
Java Quick Learning Note 01