KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > Test18


1 interface MyListener {
2     public void action();
3 }
4
5 public class Test18 {
6
7     public static void main (String JavaDoc [] args){
8         Test18 t18 = new Test18();
9         t18.run();
10     }
11
12     public void run(){
13         final String JavaDoc atMe = getString();
14         new MyListener () {
15             public void action(){
16                 System.out.println("Smile: ");
17             }
18         }.action();
19     }
20
21     public String JavaDoc getString(){
22         return "atMe";
23     }
24 }
25
Popular Tags