1, the basic data types
- Numeric
- Integer types: byte, short, int, long
- Floating-point types: float, double
- Character: char
- Boolean: boolean
2, variables and constants
- Variable: When we define variables, is to tell the compiler that we need much space to store this value, and this value will become, so called variable.
Data area (DATA) ----> program area (Program) ----> System area (OS)
- During program execution, values are placed in the data area, the program is read into memory in the program area.
- Member variables: variables defined in the body called a class member variables.
- Examples of variables: x as an example
- Static variables: y is a static variable, can be preceded by static,
the difference is that static variables can be accessed in the whole application - name of the class variable name. .
public class First{
int x = 45;
static char y = "a";
public static void main(String[] args){
}
}
3, local variables
- Class variables defined in the body of the method is called local variables.
[Comment]: when calling the method, create memory memory space for local variables, after completion of the method of execution, release the corresponding memory space to achieve garbage collection.