The data inside the stack does not have a memory address, method run creation, method end destroy.
Variable ———— is the basic data in the stack
Variables in the method:
Basic data type ———— variable = = Basic data (8 large types)
Reference data type ———— variable = = Memory address
The variables defined in the method are destroyed when the method ends. (Basic data (8 large types) and memory address are destroyed)
In (Object obj) {
}
Out () {
A variable with the same variable (local/member/static) is created when entering
In (basic data type);//create basic data type
Method ends, the variable is destroyed, the original variable or the original variable
In (reference data type);//memory address, create memory address
Method ends the memory address is destroyed, but changes to the instance are not restored
String name= "Zhang San";//final modifier, data on memory address cannot be changed
In (name) {//Create new memory address
Neme= "History";//memory address points to new memory
}//method ends, memory address is destroyed
Name refers to the original memory address
}
Javaz a variable in a method, there is no change in the data.