package com.kk.innerClass;
/**
* 通过内部类实现接口
* 解决多个接口中方法重名问题
*
*/
interface Machine {
void run();
}
class Person {
void run() {
System.out.println("person start");
}
}
public class Android extends Person {
private class MachineHeart implements Machine {
public void run() {
System.out.println("machine start");
}
}
Machine getMachine(){
return new MachineHeart();
}
public static void main(String[] args) {
Android android=new Android();
Machine machine=android.getMachine();
machine.run();
android.run();
}
}