- 1.以下集合对象中哪几个是线程安全的()
正确答案: C D
A. LinkedList
B. ArrayList
C. Vector
D. Hashtable
简单记忆线程安全的集合类: 喂!SHE! 喂是指 vector,S是指 stack, H是指 hashtable,E是指:Eenumeration -
以下代码执行后输出结果为( )
public class Test {
public static void main(String[] args) {
System.out.println("return value of getValue(): " +
getValue());
}
public static int getValue() {
try {
return 0;
} finally {
return 1;
}
}
}return value of getValue(): 1
return value of getValue(): 0
return value of getValue(): 0return value of getValue(): 1
return value of getValue(): 1return value of getValue(): 0finally语句总是要执行的,当finally语句中也有return时,会覆盖try/catch语句块的return,
-