KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > Test10


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