1 class Helper { 2 3 public static void main(String [] args){ 4 } 5 6 public void action(){ 7 System.out.println("Helper"); 8 } 9 } 10 public class Test101{ 11 12 public static void main(String [] args){ 13 Test101 t101 = new Test101(); 14 t101.run(5); 15 } 16 17 public void run(final int x){ 18 new Helper(){ 19 20 public void action(){ 21 22 class MyHelper1 { 23 public void action(){ 24 System.out.println(x); 25 26 new Helper(){ 27 public void run(final int y){ 28 System.out.println(x*x); 29 class MyHelper2{ 30 public void action(){ 31 System.out.println(x*y*x*x*x); 32 } 33 }; 34 MyHelper2 m2 = new MyHelper2(); 35 m2.action(); 36 class MyHelper3 extends MyHelper2{ 37 public void action(){ 38 super.action(); 39 } 40 }; 41 new MyHelper3().action(); 42 class MyHelper4 extends MyHelper3{ 43 public void action(){ 44 super.action(); 45 } 46 }; 47 new MyHelper4().action(); 48 49 } 50 51 }.run(7); 52 } 53 }; 54 MyHelper1 m1 = new MyHelper1(); 55 m1.action(); 56 } 57 }.action(); 58 } 59 } 60 | Popular Tags |