public class Test{
public static void main(String[]args){
int[]x={0, 1, 2, 3};
for(int i=0;i<3;i+=2){
try{
System.out println(x[i+23/x[i]+x[i+1]);
}catch(ArithmeticException e){
System.out.println("error1");
}catch (Exception e){
System.out.println("error2");
}
}
}
}
A.) error1
B.) error2
C.) error1
D.) 2
error2 error2
A.
B.
C.
D.
[单选题]下列代码的执行结果是( )。 public class Test { public static void main(String args[ ]) { System.out.println (5/2); System.out.println (100%3.0); }A.2和1B.2和1.0C.2.5和1D.2.5和1.0
[单选题]下列代码的执行结果是( )。 public class Test { public static void main (String args[]) { int a=3,b=5,c=8; String s="abc"; System.out.println(a+b+s+c); } }A.35abc8B.8abc8C.16D.abc
[单选题]下列代码的执行结果是( )。 public class Test { public static void main ( String args[]) { float f=5.0f; int i=4; System.out.println((f++) *(--i)); } }A.20B.20.0C.15D.15.0
[单选题]下列代码的执行结果是( )。public class Test{public int aMethod( ){static int i=0;i++;System.out.println(i):}public static void main (String args[]){Trest test=new Test ( );test aMethod( ):}}A.编译错误B.0C.1D.运行成功,但不输出B.C.D.
[单选题]下列代码段的执行结果是( )。 public class Test { public static void main(String args[]) } String s1=new String("hello"); String s2=new String{"hello"); System.out.println(s1==s2); System.out.println(s1.equal(s2)); } }A.true falseB.true trueC.false trueD.false
[单选题]下列代码的执行结果是( )。 public class Test { public static void main(String args[]) { int a=4,b=6,c=8; String s="abc"; System.out.println(a+b+s+c); System.out.println(); } }A.ababccB.464688C.46abc8D.10abc8
[单选题]下列代码的执行结果是public class Test{ public int aMethod(){ static int i=0; i++; System.out.println(i); } public static void main(String args[]){ Test test= new Test(); test. aMethod(); }}A.编译错误B.0C.1D.运行成功,但不输出
[单选题]下列代码段的执行结果是( )。 public class Test { public static void main(String args[ ]) { String s1= new String("hello"); String s2= new String("hello"); System.out.println(s1==s2); System.out.println(s1.equal(s2)); } }A.true falseB.true trueC.false trueD.fa
[单选题]下列代码的执行结果是( )。 public class Test { public static void main(String args[ ]) { System.out.println(5/2); System.out.println(100%3.0); } }A.2和1B.2和1.0C.2.5和1D.2.5和1.0
[单选题]下列代码的执行结果是( )。 public class Test { public static void main(String args[]) { System.out.println(7/2); } }A.3.5B.3C.3.0D.3.50