Variable (variable): The most basic storage unit in the program, including the variable name, type, scope
Variables should be declared, only after the system will allocate the corresponding length of storage space, the variable is essentially the name of the storage unit
Variables are divided into local variables, member variables, constants. A local variable is typically a variable defined inside a method, and is initialized before it is declared.
A member variable is also called an instance variable or attribute, which is usually a variable defined in a class, and the method is placed at the same level, and the scope is larger than the local variable
Constant final, which is a variable that can only be initialized once, also known as the final variable
Variable naming conventions: Naming of methods and variables--lowercase letters, hump principle
Class naming-initial capitalization, hump principle
Name of the constant--all caps
Public classVariable { Public intA//A is a member variable, here is the declaration of a Public Static voidMain (string[] args) {intb//b is the local variable inside the main method, here is the declaration of itb = 0;//This line is initialized with 0 pairs of variable b Final intC = 1;//C is a constant, we initialize it directly when declaring it, the value of C will always be 1, cannot be changed }}
Java 0 Basic Series 003--variables