static initializer: execute it when loading the class file
[mate.git] / tests / Static8.java
1 package tests;
2
3 public class Static8 extends Static8_local {
4         public static int x;
5         public static int y;
6
7         static {
8                 Static8_local.x = 0x1337;
9                 Static8_local.y = 0x555;
10         }
11
12         public static void main(String []args) {
13                 Static8.addNumbers(); // 0x188c
14                 // System.out.printf("%x\n", Static8.addNumbers());
15         }
16 }
17
18 class Static8_local {
19         public static int x;
20         public static int y;
21
22         static {
23                 Static8_local.x = 0x11;
24                 Static8_local.y = 0x22;
25                 Static8_local.addNumbers(); // 0x33
26                 // System.out.printf("%x\n", addNumbers());
27         }
28
29         public static int addNumbers() {
30                 return Static8_local.x + Static8_local.y;
31         }
32 }