KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > Test47


1 public class Test47{
2
3     public static void main(String JavaDoc [] args){
4         Test47 t47 = new Test47();
5         t47.run();
6     }
7     
8     public void run(){
9         class MyClass{
10             public int x = 9;
11             public void run(){
12                 System.out.println(x);
13             }
14         };
15         MyClass mc = new MyClass();
16         mc.run();
17         new MyClass(){
18             public void run(){
19                 System.out.println(x*x);
20             }
21         }.run();
22     }
23 }
24
Popular Tags