题目
(17 )下列程序的输出结果是
public class Test{
public static void main(String[] args){
int [] array={2,4,6,8,10};
int size=6;
int result=-1;
try{
for{int i=0;i<size && result==-1;i++}
if(array[i]==20) result=i;
}
catch(ArithmeticException e){
System.out.println(" Catch---1 " );
catch(ArrayIndexOutOfBoundsException e){
System.out.println(" Catch---2 " );
catch(Exception e){
System.out.println(" Catch---3 " );
}
}
A ) Catch---1
B ) Catch---2
C ) Catch---3
D )以上都不对
第1题
若有如下程序: #include<iostream> using namespace std; int s=O; class sample { static int n; public: sample(int i) { n=i; } static void add() { s+=n; } }; int sample::s=0; int main() { sample a(2),b(5); sample::add(); cout<<S<<end1; return 0; } 程序运行后的输出结果是
A.2
B.5
C.7
D.3
第3题
下列程序的输出结果是______。
main()
{ int k=17;
printf("%d,%o,%x\n",k,k,k);
}
第5题
A.0
B.a
C.5
D.f
第6题
下列程序的输出结果是______。 main() { int k=17; printf("%d,%0,%x \n",k,k,k); }
A.17,021,0x11
B.17,17,17
C.17,Ox11,021
D.17,21,11
第7题
第8题
下列程序的执行结果是______。 class A5 extends Thread { boolean b; A5 (boolean bb) { b = bb; } public void run() { System.out.println(this.getName() + "运行"); } } public class Testl5 { public static void main(String[] args) { A5 a1 = new A5(true); A5 a2 = new A5(false); if(a1.b) A1.start(); if (a2 .b) A2.start(); } }
A.Thread-0
B.Thread-1
C.Thread-0
D.Thread-1 Thread-1 Thread-0
第9题
A.19
B.17
C.39
D.37
为了保护您的账号安全,请在“赏学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!