Dog dog = new Dog();//1
create function //2
我理解创建function对象时是下面的过程,
Dog insideDog = dog;
functionMethod(insideDog,Integer){
process Integer parameter with insideDog;
}
dog = null; //3,dog置为null并不影响上面的insideDog的值
call functionMethod//4
这种顺序4不受3的影响。但如果把3提前到2,此时肯定会报空指针的。
所以为什么不报空指针的关键应该是function对象的创建时做了什么,而不是传值还是传址。