KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > Test6


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