public class A {
class B{
int b = 66666;
public int getNum(){
return b;
}
}
public B getB(){
return new B();
}
public static void main(String args[]){
A a = new A();
B b = a.getB();
}
}
或者这样:
public class A {
public class B{
int b = 66666;
public int getNum(){
return b;
}
}
public static void main(String args[]){
A a = new A();
B b = a.new B();
}
}