OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [testsuite/] [libjava.lang/] [anon.java] - Blame information for rev 830

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 765 jeremybenn
// Class anon
2
// Generated on Wed Dec 29 10:07:09 PST 1999
3
//
4
 
5
 
6
interface itf {int count = 0;void setCount (int i);int getCount ();}
7
 
8
class anon {
9
 
10
  int count = 34;
11
 
12
  class x implements itf {
13
      int count = 3;
14
      public void setCount (int j) { }
15
      public int getCount () { return count*3; }
16
  }
17
 
18
 
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; }
24
      }
25
      return new y ();
26
  }
27
 
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
    } ;
35
  }
36
 
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);
45
  }
46
 
47
  public static void main (String[] arg)
48
  {
49
    System.out.println ("Testing class `anon'...");
50
    new anon ().test ();
51
  }
52
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.