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
|
public class { static { System.out.println("super static block"); }
StaticSuper() { System.out.println("super constructor"); } }
public class StaticTests extends { static int rand; static { rand = (int) Math.random() * 6; System.out.println("static block " + rand); }
StaticTests() { System.out.println("constructor"); }
public static void main(String[] args) { System.out.println("in main"); StaticTests st = new StaticTests(); } }
|
近期评论