public static void main(String[] args)...{
RobotPerson robot=new RobotPerson();
Machine machine=robot.getMachine();
machine.run();
robot.run();
}
}
public static void main(String[] args)...{
RobotPerson robot=new RobotPerson();
Machine machine=robot.getMachine();
machine.run();
robot.run();
}
}编译运行:

▲ 内部类实现接口
编写一个实现接口的内部类:

interface Animal...{
void eat();
void sleep();
}
class Zoo...{
class Tiger implements Animal...{ //实现接口的内部类
public void eat()...{
System.out.println("Tiger eat!");
}