更多“下述代码中,statement应该如何写才能使得程序输出1 int t = 1; try { ...... throw t; ...... } catch (statement ) { cout <<…”相关的问题
第1题
【单选题】(9-3)执行以下程序的输出结果是( )。 public class Demo { public static void main(String[] args) { try { return; } finally { System.out.println("1"); } } }
A、编译失败
B、运行时抛出异常
C、1
D、程序能够正常运行但没有任何输出
点击查看答案
第2题
/*编写打印以下图形的程序(行与行之间没有空行,第三行与左边界没有空格)。*/ * *** ***** #include <stdio.h> int main() { char c= '*',s=' '; int i,j; for(i=0;i<3;i++) { for(j=";j">0; j--) printf("%c",s); for(j=0;j<2*i+1;j++) printf("%c",c); printf("\n"); } return 0;>
点击查看答案
第3题
下列程序的执行,说法正确的是( )class MultiCatch { public static void main(String args[]) { try { int a=args.length; int b=42/a; int c[]={1}; c[42]=99; //10行 System.out.println(“b=”+b); } catch(ArithmeticException e) { System.out.println(“除0异常:”+e); //15行 } catch(ArrayIndexOutOfBoundsException e) { System.out.println(“数组超越边界异常:”+e); //19行 } } }
A、程序将输出第15行的异常信息
B、程序第10行出错
C、程序将输出“b=42”
D、程序将输出第19行的异常信息
点击查看答案
第4题
下面程序的运行结果是? public static void main(String[] args) { int x = 8; int y = 4; if(x++>8 && ++y<4){ system.out.print(x); }else{ system.out.print(y); } system.out.printf("%d%d",x,y);> A、995
点击查看答案
第5题
运算符重载的本质是__________
点击查看答案
第6题
在如下给定的代码中,为 MyCircle 类重载关系运算符 >、< >=、< >
点击查看答案
第7题
当使用参数将被调函数中的错误信息返回给主调函数时,被调函数的参数类型应该是:
A、int *
B、int
C、string
D、exception
点击查看答案
第8题
程序如果出现了一个整数溢出错误,则应该抛出的异常是
A、bad_exception
B、bad_cast
C、logic_error
D、runtime_error
点击查看答案