class Person{
public void eat (Apple apple){
Apple peeled=apple.getPeeled();
System.out.println("Yummy");
}
}
class Reeler{
static Apple peel(Apple apple){
return apple;
}
}
class Apple{
Apple getPeeled(){
return Peeler.peel(this);
}
}
public class PassingThis{
public static void main(String args[]){
new Person().eat(new Apple());
}
}
在new Person().eat(new Apple());中,并未创建Appla类对象,它是如何调用eat()方法的。
说错了,应该是Person类。
好吧,我知道了T.T
他喵的,new Person()就是一个新创建的对象了,那它的引用呢?
那么说这个对象不能被调用?或者讲是一次性的?