第6章 异常和断言
1[单选题]哪个关键字可以抛出异常? ( )
A.transientB.finallyC.throwD.static
参考答案:C
2[单选题]给出一段程序,试判断哪个是正确的结果( )
public class rtExcept{
public static void throwit(){
System.out.print(“throwit”);
throw new RuntimeException();
}
public static void main(String [] aa){
try{
System.out.print(“hello “);
throwit(); }
catch(Exception re){
System.out.print(“caught ”); }
finally{
System.out.print(“finally ”); }
System.out.print(“after ”);
}
}
A.hello throwit caught
B.hello throwit caught finally after
C.hello throwit RuntimeException after
D.hello throwit caught finally after RuntimeException
参考答案:B
3[单选题]下列叙述中正确的是
A.软件测试应该由程序开发者来完成
B.程序经调试后一般不需要再测试