4
34
43
14
第1题:
下列程序的输出结果是( )。 Public class Test{ Public static void main(String[]args){ int[]array=(2,4,6,8,10); int size=6; int result=-l: try{ for(int i=0;i<sizeresult= =-1:) if(array[i]= =20)result=i: } catch(ArithmeticException e){ System.out.println("Catch---1"); } catch(ArraylndexOutOfBoundsException e){ System.out.println("Catch---2"): } catch(Exception e){ System.out.println("Catch---3"): } }
A.Catch---1
B.Catch---2
C.Catch---3
D.以上都不对
第2题:
下列程序的输出结果是( )。 public class Test{ public static void main(String[]args){ int[]array=(2,4,6,8,lO); int size=6; int result =-1: try{ for(int i=0;i(size 8L&result= = -1;) if(array[i]= =20)result=i: } catch(ArithmeticException e){ System.out.println("Catch- - -l"); } catch(ArraylndexOutOfBoundsException e){ System.out.println("Catch- - -2"); } catch(Exception e){ System.out.println("Catch- - -3");) } }
A.Catch- - -1
B.Catch- - -2
C.Catch- - -3
D.以上都不对
第3题:
( 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 )以上都不对
答案暂缺
第4题:
public class TestApp{ public static void main(String[] args){ try{ int i = 0; int j = 1 / i; System.out.println(“1”); } catch(Exception e){ System.out.print(“3”); } finally{ System.out.print(“4”); } } } 上述程序运行后的输出是哪项?()
第5题:
程序: class TestApp{ int i public static void main(String[] args){ for(int i=0;i<5;i++) System.out.print(i+1); System.out.println(i); (i没有定义) } } 上述程序运行后的结果是哪项?()
第6题:
程序: class TestApp{ public static void main(String[] args){ for(int i=0;i<10;i++){ if(i==3) break; System.out.print(i); } } } 程序运行后的输出是哪项?()
第7题:
public class TestApp{ public static void main(String[] args){ try{ String myname = null; if(myname.length()>2) System.out.print(“1”); }catch(NullPointerException e){ System.out.print(“2”); } } } 上述程序运行后的输出是哪项?()
第8题:
4
34
43
14
第9题:
123456
123455
123450
编译错误
第10题:
error1:10.5
error2
error1:10.5error2
以上都不对
第11题:
1
12
21
2
第12题:
123456
123455
123450
编译错误
第13题:
下列程序的运行结果是( )。 public class test{ private String[]data={¨10","10.5"}, public void fun( double S=0; for(int i=0;i<3;i++){ try{ s=s+Integer.parseInt(data[i]); catch(Exception e){ System.out.print(“errorl:”+data[i])。 } } } public static void main(string[]args){ try{ test d=new test; fun; }catch(Exception e){ System.out.println("error2") } } }
A.errorl:10.5
B.error2
C.errorl:10.5 error2
D.以上都不对
第14题:
下列程序运行后的输出结果是( )。 public class Sun { public static void main(String args[]) { int i,j,s; s=0; for(i=1;i<=3;i++) for(j=0;j<=i-1;j++) s=s+1; System.out.println(s); } }
A.6
B.5
C.4
D.3
第15题:
程序: class TestApp{ public static void main(String[] args){ for(int i=0;i<5;i++) System.out.print(i+1); System.out.println(i); } } 上述程序运行后的结果是哪项?()
第16题:
class TestApp{ public static void main (String[ ] args){ for(int i=0;i<10;i++){ if(i==3) break; System.out.print (i); } } } 程序运行后的输出是哪项?()
第17题:
程序: class TestApp{ public static void main() String[] args){ for(int i=0;i<10;i++){ if(i==3) break; 当循环到3时,自动跳出 System.out.print(i); } } } 程序运行后的输出是哪项?()
第18题:
public class TestApp{ public int mymethod(){ try{ int i = 0; int j = 1 / i; System.out.println(“1”); }finally{ System.out.print(“4”); } return 1; } } 上述程序运行后的输出是哪项?()
第19题:
public class TestApp{ public static void main(String[] args){ try{ int i = 0; int j = 1 / i; String myname=null; if(myname.length()>2) System.out.print(“1”); }catch(NullPointerException e){ System.out.print(“2”); } catch(Exception e){ System.out.print(“3”); } } } 上述程序运行后的输出是哪项?()
第20题:
0123
012
0123456789
012456789
第21题:
0123
012
0123456789
012456789
第22题:
3
2
231
32
第23题:
0123
012
0123456789
012456789
第24题:
4
14
41
以上都不对