2011年JAVA认证模拟题(44)
Q130 Which of the following are true about an unreachable object?A It will be garbage collected.
B Its finalize () method will be invoked.
C It can become reachable again.
D It has a null value.
Q131 What is the value displayed by the following program?
class Question {
public static void main (String[] args)
{
int x = 0;
boolean b1, b2, b3, b4;
b1 = b2 = b3 = b4 = true;
x = (b1 |b2 & b3 ^ b4) ? x++ : --x;
System.out.println(x);
}
}
A -1
B 0
C 1
D true
2011年JAVA认证模拟题(44)
</p> Q132 What is the possible output of the following program?import java.util.*;
class Question {
public static void main (String args[])
{
HashSet set = new HashSet();
String s1 = “abc”;
String s2 = “def”;
String s3 = “”;
set.add(s1);
set.add(s2);
set.add(s1);
set.add(s2);
Iterator i = set.iterator();
while(i.hasNext()) {
s3 += (String) i.next();
}
System.out.println(s3);
}
}
A abcdefabcdef
B defabcdefabc
C fedcbafedcba
D defabc
Q130 C
Q131 B
Q132 D
页:
[1]