14、下面程序运行的结果是() class Demo{ public static void main(String[] args){ try{ int x = div(1,2); }catch(Exception e){ System.out.println(e); } System.out.println(x) } public static int div(int a,int b){ return a / b ; } }
A、A.输出1
B、B.输出0
C、C.输出0.5
D、D.编译失败
第1题
public class demo {
public static void main(string[] args) {
try { system.out.println(10 / 0)
system.out.println("除法正常运行")
} catch (arithmeticexception e) {
system.out.println("除数不能为0")
}
}
}
</p>
A、编译失败
B、编译通过,没有结果输出
C、输出:除法正常运行
D、输出:除数不能为0
第2题
A.It's finally caught!
B.It's caught!
C.It's caught!/It'sfinally caught!
D.无输出
第3题
A.It's finally caught!
B.It's caught!
C.It's caught!/It's finally caught!
D.无输出
第4题
A.Catch---1
B.Catch一--2
C.Catch---3
D.以下都不对
第5题
classMultiCatch{
publicstaticvoidmain(Stringargs[]){
try{
inta=args.length;
intb=44/a;
intc[]={2,6};
c[44]=100;
System.out.println("b="+b);
}catch(ArithmeticExceptione){
System.out.println("除0异常");
}catch(ArrayIndexOutOfBoundsExceptione){
System.out.println("数组超越边界异常");
}finally{
System.out.println("程序执行结束");
}
}
}
运行结果是:
第6题
publicclassJ_Test{
publicstaticvoidmain(String[]args){
try{
return;
}
finally{
System.out.println("1");
}
}
}
A、上面程序含有编译错误
B、上面程序在运行时会产生一个运行时异常
C、上面程序会正常运行,但不产生任何输出
D、上面程序输出“1”
第7题
A.Catch- - -1
B.Catch- - -2
C.Catch- - -3
D.以上都不对
第8题
A.Catch- - -1
B.Catch- - -2
C.Catch- - -3
D.以上都不对
第9题
A.Catch---1
B.Catch---2
C.Catch---3
D.以上都不对
第10题
A.Catch---1
B.Catch---2
C.Catch---3
D.以上都不对
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!