当前位置: 技术问答>通过了SCJP认证以后,还能干什么?
iis7站长之家
SCJP模拟题 about Exception
来源: 互联网 发布时间:2015-03-27
本文导语: Given the following method: public void method() { try { delicate(); System.out.println("1"); } catch(ArrayIndexOutOfBoundsException e) { System.out.println("2"); } finally ...
Given the following method:
public void method()
{
try
{
delicate();
System.out.println("1");
}
catch(ArrayIndexOutOfBoundsException e)
{
System.out.println("2");
}
finally
{
System.out.println("3");
}
System.out.println("4");
}
Which messages must be displayed if the method delicate() completes normally, without throwing any exceptons?
A. 1
B. 2
C. 3
D. 4
E. None
我选ACD,答案竟然是A D???
public void method()
{
try
{
delicate();
System.out.println("1");
}
catch(ArrayIndexOutOfBoundsException e)
{
System.out.println("2");
}
finally
{
System.out.println("3");
}
System.out.println("4");
}
Which messages must be displayed if the method delicate() completes normally, without throwing any exceptons?
A. 1
B. 2
C. 3
D. 4
E. None
我选ACD,答案竟然是A D???
|
答案也有错误的,别老相信答案……
|
答案是错的,不管怎样,finally里的内容肯定会执行
|
trust yourself!