2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / libjava / testsuite / libjava.lang / anon.java
blobc24b4f0a2bae0cce7cb51075324dae33afc9f8e4
1 // Class anon
2 // Generated on Wed Dec 29 10:07:09 PST 1999
3 //
6 interface itf {int count = 0;void setCount (int i);int getCount ();}
8 class anon {
10 int count = 34;
12 class x implements itf {
13 int count = 3;
14 public void setCount (int j) { }
15 public int getCount () { return count*3; }
19 itf foo () {
20 class y implements itf {
21 int count = 3;
22 public void setCount (int j) { count = j; }
23 public int getCount () { return count+1; }
25 return new y ();
28 itf bar () {
29 return new itf () {
30 // The class defined right here will implement `itf'
31 int count = 5;
32 public void setCount (int j) { count = j; }
33 public int getCount () { return count+1; }
34 } ;
37 void test () {
38 itf a = foo ();
39 itf b = bar ();
40 x c = this.new x ();
41 System.out.println (a.getCount ());
42 System.out.println (b.getCount ());
43 System.out.println (c.getCount ());
44 System.out.println (this.count);
47 public static void main (String[] arg)
49 System.out.println ("Testing class `anon'...");
50 new anon ().test ();