标签:java内部类
interface DemoInterface{
public void getStringDemo();
}
public class Demo1{
private class DemoOne implments DemoInterface{
public void getStringDemo(){
return "abcdefg";
}
}
public DemoInterface getDemoInterface(){
return new DemoOne();
}
}
public class TestMain(){
Demo1 demo = new Demo1();
DemoInterface demointerface = demo.getDemoInterface();
System.out.println(deominterface.getStringDemo());
}
标签:java内部类
原文地址:http://blog.csdn.net/shaohuazuo/article/details/46044905