标题: 菜鸟求助,关键字this,一下是关键字This的运用,但是没不... [打印本页] 作者: xingfeichen 时间: 2015-5-8 20:14 标题: 菜鸟求助,关键字this,一下是关键字This的运用,但是没不... class Person {
public void eat (Apple apple){
Apple peeled = apple.getPeeled();
System.out.println("Yummy");
}
}
class Peeler{
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());
}
}