package day05匿名内部类和多态.homework05_02;
//要求在控制台输出”HelloWorld”
interface Inter {
void show();
}
class Outer {
//补齐代码
public static Inter method(){
//返回一个Inter类型的对象
// A a = new A();
Inter a = new A();
//也可使用多态 Inter a = new A();
return a;
}
}
class A implements Inter{
public void show(){
System.out.println(“HelloWorld”);
}
}
public class OuterDemo {
public static void main(String[] args) {
Outer.method().show();
}
}