stack value relationship

http://www.cnblogs.com/iliuyuet/p/5603618.html
1, stack reference; stack value, shareable

2, int a=3
create a reference to a in the heap; create a
literal value of 3 in the stack ;
The reference a points to the value

3 of 3, String str = "abc"
(1) Create a reference to str in the heap;
(2) Check the stack to see if there is an address with the value "abc", if not, open a Store the address whose literal value is "abc", then create a new object o of class String, point the string value of o to this address, and note the referenced object o next to this address on the stack. If there is already an address with the value "abc", look up the object o, and return the address of o.
(3) Point str to the address of object o.


4. String str1 = "abc"; String str2 = "abc";

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326274067&siteId=291194637