Javaz a variable in a method, there is no change in the data.

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.