01 class Account { Long acctNum, password;}
02 public class Banker {
03 public static void main(String[] args){
04 new Banker().go(); //created object
05 //Here there are 4 objects eligible to GC
06 }
07 void go(){
08 Account a1 = new Account(); //created object
09 a1.acctNum = new Long("1024"); //created object
10 Account a2 = a1;
11 Account a3 = a2;
12 a3.password = a1.acctNum.longValue();
13 a2.password = 4455L;
14 }
15 }
在第 13 行创建了一个 long 并且当 autobox 使包装器 Long 时,可能是创建的第四个对象吗?
以下行是否也在创建对象?
long l = 4455L;
long m = 4455;
long n = 4455l;