summaryrefslogtreecommitdiff
path: root/libjava/testsuite/libjava.lang/StaticConstructor.java
blob: 54c0f5376df3051c4b078aae5d516a10111f4b99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Test to make sure static initializers are called

class bar
{
  public static int zog;
  public static int zag;

  static
  {
    zog = 12;
    zag = 2;
  }

  public bar() { } 
}

public class StaticConstructor
{
  static int foo ()
  {
    return new bar().zog;
  }

  public static void main(String args[])
  {
    System.out.println ("" + (foo() + bar.zag));
  }
}