interface Contents
{
void show(){};
}
public class Test1 {
public Contents con()
{
return new Contents()
{
public void show()
{
System.out.println("啊啊啊啊啊");
}
};
}
public static void main(String [] args)
{
Test1 t = new Test1();
Contents c = t.con();
c.show();
}
show()方法为什么一定要写明是public的(不然不能运行),难道匿名内部类内部成员默认是private |