- public class test
- {
- public static void main(String[] args) {
- A a = new A();
- A.B b = new A().new B();
- a.name = "aaa";
- b.name = "bbb";
- System.out.println(a.name);
- System.out.println(b.name);
- }
- }
- class A {
- String name;
- void fun() {}
- class B {
- String name;
- void fun1() {}
- }
- }
复制代码 你是意思是这样吗?
结果没问题啊? |