网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
执行下列程序段,请选出正确的答案()
A.能通过编译
B.输出“开始了”→RuntimeException异常发生→输出“出错了”→输出“结束了”
C.输出“开始了’→RuntimeException异常发生→输出”结束了”
D.输出“开始了→输出”结束了”→RuntimeException异常发生
参考答案
更多 “ 执行下列程序段,请选出正确的答案()A.能通过编译B.输出“开始了”→RuntimeException异常发生→输出“出错了”→输出“结束了”C.输出“开始了’→RuntimeException异常发生→输出”结束了”D.输出“开始了→输出”结束了”→RuntimeException异常发生 ” 相关考题
考题
下列关于如下这段代码的说法中正确的是( )。 public class test { public static void throwit() { throw new RuntimeException(); } public static void main(String args[]) { try{ System.out.println(“你好吗”); throwit(); System.out.println(“出错!”); } finally{ System.out.println(“结束”); } } }A.以上程序段不会编译B.程序输出“你好吗”,然后有RuntimeException异常发生,输出“出错!”,输出“结束”C.程序输出“你好吗”,然后有RuntimeException异常发生,然后输出“结束”D.程序输出“你好吗”,然后输出“结束”,然后有RunthneException异常发生
考题
下列关于如下这段代码的说法中正确的是( )。 public class test { public static void throwit() { throw new RuntimeException(); } public static void main(String args[]) { try{ System.out.println("你好吗"); throwit(); System.out.println("出错!"); } finally{ System.out.println("结束"); } } }A.以上程序段不会编译B.程序输出“你好吗”,然后有RuntimeException异常发生,输出“出错!”,输出“结束”C.程序输出“你好吗”,然后有RunfimeException异常发生,然后输出“结束”D.程序输出“你好吗”,然后输出“结束”,然后有RuntimeException异常发生
考题
请阅读下列的程序publicclassExample01{publicstaticvoidmain(Stringargs){intnum=127;byteb=num;System、out、printIn(b);}}程序的运行结果是()。
A、编译通过,执行报错B、编译报错C、以上选项均不正确D、编译通过,执行输出127
考题
关于以下程序段的执行结果,说法正确的是()。publicclassborleyextendsThread(publicstaticvoidmain(Stringargv[]){borleyb=newborley();b.start();}publicvoidrun(){System.out.println("running");}}A.编译通过并执行,但无输出B.编译通过并执行,输出:runningC.产生错误,没有thread类对象D.产生错误,没有通道到达thread包
考题
下面程序段的执行结果是()。 public class Foo{ public static void main(String[] args){ try{ return; } finally { System.out.println("Finally!");} } }A.程序正常运行,但不输出任何结果B.程序正常运行,并输出Finally!C.编译能通过,但运行时会出现例外D.因为没有catch语句块,所以不能通过编译
考题
请阅读下列的程序,程序的运行结果是 public class Example01 { public static void main(String[] args) { int num = 127; byte b = num; System.out.println(b); } }A.编译报错B.编译通过,执行输出127C.编译通过,执行报错D.以上选项均不正确
考题
下面的程序段执行结果是 public class Foo { public static void main(String[] args) { try{ return; }finally { System.out.println("finally"); } } }A.编译通过,但运行时出现异常B.程序正常运行,不输出任何结果C.程序正常运行,并输出“finally”D.因为没有catch语句,编译错误
考题
关于以下程序段的说明正确的是 ()public class Test { public static void main(String args[]) { try { int x[] = new int[-5]; System.out.println("此行将无法被执行!"); } catch (NegativeArraySizeException e) { System.out.println("exception: 数组下标不能为负数。"); } } }A.编译通过,输出: 此行将无法被执行!B.编译通过,输出: 此行将无法被执行! exception: 数组下标不能为负数。C.编译通过,输出: exception: 数组下标不能为负数。D.编译不能通过
考题
【单选题】下面的程序段执行结果是()。 public class None { public static void main(String[] args) { try{ return; }finally { System.out.println("finally"); } } }A.编译通过,但运行时出现异常B.程序正常运行,不输出任何结果C.程序正常运行,并输出“finally”D.因为没有catch语句,编译错误
热门标签
最新试卷