package project;
public class WaiBuLei {
public class NeiBuLei{
public void show(){
System.out.println("内部类与外部类!");
}
NeiBuLei m = new NeiBuLei();
m.show();
}
public static void main(String[] args) {
WaiBuLei n = new WaiBuLei();
NeiBuLei h = n.new NeiBuLei();
h.show();
}
}
定义的方法要在内部类中的方法中调用啊,你再创建一个方法,方法里直接show()就可以了