KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > InitTest4


1 public class InitTest4 {
2
3     public class Inner1 {
4         public void m() {
5             System.out.println("hello from inner 1");
6         }
7     }
8
9     public static class Inner2 {
10         public void m() {
11             System.out.println("hello from inner 2");
12         }
13     }
14
15     public static interface InnerInterface1 {
16         public void go();
17     }
18     
19     public interface InnerInterface2 {
20         public void go();
21     }
22     
23     public static void main(String JavaDoc [] args){
24         InitTest4 it = new InitTest4();
25         it.run();
26         //Inner1 in = new Inner1();
27
class MyClass extends Inner2{
28             public void m() {
29                 System.out.println("hello from anon subtype of inner 1");
30             }
31         };
32         /*class MyClass1 extends MyStaticClass1{
33             public void m() {
34                 System.out.println("hello from anon subtype of inner 1");
35             }
36         };*/

37
38         new Inner2 () {
39             public void m(){
40                 System.out.println("hello from inner 2 again");
41             }
42         }.m();
43
44         new InnerInterface1 () {
45             public void go(){
46                 System.out.println("go");
47             }
48         }.go();
49
50         new InnerInterface2 () {
51             public void go(){
52                 System.out.println("go2");
53             }
54         }.go();
55
56         
57     }
58
59     public void run(){
60         new Inner1 () {
61             public void m() {
62                 System.out.println("hello from anon subtype of inner 1");
63             }
64         }.m();
65     }
66 }
67
68
Popular Tags