outer.java
package com.inner;
public class Outer {
private String a="test";
class Inner{
private static final int i=8;
private String a="ss";
void test()
{
System.out.println("hello "+i);
System.out.println("outer test "+a);
System.out.println("string is "+this.a);
System.out.println("String in outer is "+Outer.this.a);
}
}
}
TestOuter.java
package com.inner;
public class TestOuter {
public static void main(String[] args) {
//Outer.Inner inn=new Outer().new Inner();
Outer out=new Outer();
Outer.Inner inn=out.new Inner();
inn.test();
}
}
No comments:
Post a Comment