//出自Thinking in Java 4 //它是如何调用的?参数是如何传递的? //这Apple哪来的?不是应该是int chat String之类的吗 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()); } }
sanlelele
bug侠
bug侠
相关分类