Management of Java Piles - Garbage Recycling

xiaoxiao2021-03-05  27

http://dev.9cbs.net/Article/60/60811.shtm

PS:

INT i = 2, j = 7; system.out.println ("1: i =" i ", j =" j); i = j; system.out.println ("2: i =" i ", j =" j); i = 5; system.out.println ("3: i =" i ", j =" j);

Some people say: The last print result is: 3: i = 5, J = 5

The reason is: "i = j" makes i point to the space of J, that is, i, j public uniform space, and the original space will be "garbage" recycled. Then when "i = 5" is to "i = 5", 5 coverage of the original 7 in J.

Practice has proven that this is an opinion.

转载请注明原文地址:https://www.9cbs.com/read-35573.html

New Post(0)