单项选择题
class Rectangle { public static void main(String [] args) { int [] x = {1,2,3}; x[1] = (x[1] 〉 1) ? x[2] : 0; System.out.println(x[1]); } } 结果为:()
A.0 B.1 C.2 D.3
class MyApp{ public static void main(String[] args){ ...
class MyApp{ public static void main(String[] args){ int age; System.out.println(“age=”+age); } } 执行上述代码后输出的结果是哪项?()
A.age=0 B.age=null C.age= D.程序编译错误
class Beta { public static void main(String [] args) ...
class Beta { public static void main(String [] args) { Integer x = new Integer(6) * 7; if (x != 42) { System.out.print("42 "); } else if (x.equals(42)) { System.out.print("dot = "); } else { System.out.print("done"); } } } 结果为:()
A.42 B.done C.dot = D.编译失败
class Account { private int balance; public void se...
class Account { private int balance; public void setBalance(int b) { balance = b; } public int getBalance() { return balance; } public void clearBalance() { balance = 0; } } 哪一个改变可以使 Account 类线程安全?()
A.在第2行加 synchronized 修饰符。 B.在第3行加 synchronized 修饰符。 C.在第3行、第4行和第6行加 synchronized 修饰符。 D.在第4行、第6行和第8行加 synchronized 修饰符。