Java认证模考试题(四)
文章作者 100test 发表时间 2007:03:14 17:03:02
来源 100Test.Com百考试题网
Question: 21
What will be output after execution of the following code:
outer: for(int i=0.i<3. i )
inner: for(int j=0.j<2.j )
{
if(j==1) continue outer.
System.out.println(j ?and ? i).
}
A. 0 and 0
B. 0 and 1
C. 0 and 2
D. 1 and 0
E. 1 and 1
F. 1 and 2
G. 2 and 0
H. 2 and 1
I. 2 and 2
Explanation:
The continue statement is used to skip over and jump to the end of the loop body. Then if j equals to 1 it will jump to the end of the inner loop body.
Correct Answer: A,B,C 21 of 60
Question: 22
Given the following code:
switch (m)
{
case 0: System.out.println(Condition 0).
case 1: System.out.println(Condition 1).
case 2: System.out.println(Condition 2).
case 3: System.out.println(Condition 3).break.
default: System.out.println(Other Condition).
}
Which values of m will cause Condition 2 is output?
A. 0
B. 1
C. 2
D. 3
E. 4
F. None
Explanation:
In the block of switch, if there is no break sentence in one case the following sentences will be executed.
Correct Answer: A,B,C 22 of 60
Question: 23
Which method is called when the browser returns to the page containing the applet after moving to another URL?
A. init()
B. start()
C. stop()
D. destroy()
Explanation:
The start() runs whenever the applet becomes visible, such as when the browser returns to the page containing the applet after moving to another URL or the browser is restored after being iconized.
Correct Answer: B 23 of 60