JavaSE 面试题 类初始化和实例初始化等 class Father { private int i = test(); private static int j = method(); static { System.out.print("(1)"); } Father() { System.out.print("(2)"); } { System.out.print("(3)"); } public int test() { System.…
JavaSE 面试题 成员变量与局部变量 public class Test { static int s; int i; int j; { int i = 1; i++; j++; s++; } public void test(int j) { j++; i++; s++; } public static void main(String[] args) { Test t1 = new Test(); Test t2 = new Test(); t1.test(10); t1.test(20…
JavaSE 笔试题 自增变量 public class Test { public static void main(String[] args) { int i = 1; i = i++; int j = i++; int k = i + ++i * i++; System.out.println("i=" + i); System.out.println("j=" + j); System.out.println("k=" + k); }…