* tests/gc/ClassInit.java: Added testcase (static initializer calling gc).
[cacao.git] / tests / gc / ClassInit.java
1 class ClassInitTest {
2         static {
3                 System.out.println("Static Initializer will call the GC ...");
4                 System.gc();
5         }
6
7         public void test() {
8                 System.out.println("Object fine.");
9         }
10 }
11
12 public class ClassInit {
13         public static void main(String[] s) {
14                 String t;
15                 ClassInitTest o;
16
17                 System.out.println("Preparing a String ...");
18                 t = new String("Remember Me!");
19
20                 System.out.println("Static Initializer will be called ...");
21                 o = new ClassInitTest();
22                 o.test();
23
24                 System.out.println("String: " + t);
25                 System.out.println("Test fine.");
26         }
27 }