KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > Test9


1 interface MyListener {
2     public void action();
3 }
4 public class Test9 {
5
6     private int x = 9;
7     
8     public static void main (String JavaDoc [] args){
9         Test9 t = new Test9();
10         t.run();
11     }
12
13     public void run(){
14         class MyListener1 implements MyListener {
15             public void action(){
16                 System.out.println("Smile: "+x);
17                 go();
18             }
19         };
20         MyListener ml = new MyListener1();
21         ml.action();
22     }
23
24     private void go(){
25         System.out.println("today");
26     }
27 }
28
Popular Tags