/**
* This code is from the book:
* Winder, R and Roberts, G (1998)
* Developing Java Software
* John Wiley & Sons.
* It is copyright (c) 1997 Russel Winder
* and Graham Roberts.
*/
class l1Memb2{//Class6
private class A{
private class B{
private class C{
public void test(){
System.out.println(name);
System.out.println(A.this.name);
System.out.println(B.this.name);
System.out.println(C.this.name);
}
private String name = "C";
}
public void test(){
C c = new C();
System.out.println(name);
System.out.println(A.this.name);
System.out.println(B.this.name);
c.test();
}
private String name = "B";
}
public void test(){
B b = new B();
System.out.println(name);
System.out.println(l1Memb2.this.name);
b.test();
}
private String name = "A";
}
public void test(){
A a = new A();
a.test();
}
public static void main(String[] args){
l1Memb2 c6 = new l1Memb2();
c6.test();
}
private String name = "l1Memb2";
}
/******** sample compilation & run *******
# javac l1Memb2.java
# java l1Memb2
A
l1Memb2
B
A
B
C
A
B
C
#
******************************************/