更多"请阅读下列程序代码,然后将程序的执行结果补充完整。 程序代码: "的相关试题:
[填空题]请阅读下列程序代码,然后将程序的执行结果补充完整。
程序代码:
public class throwsExcepfion{
static void Proc(int se1)
throws ArithmeticException,ArraylndexOutOfBoundsException {
System.out.println("in Situation"+se1);
if(se1==0){
System.out.println("no Exception caught");
return;
}else if(se1==1){
int iArray[]=new int[4];
iArray [1]=3;
}
}
public static void main(String args[])[
try{
Proc(0);
Proc(1);
} catch(ArraylndexOutOfBoundsException e) {
System.out.println("Catch"+e);
}finally{
System.out.println("in Proc finally");
}
}
}
执行结果:
In Situation( )
no ExcepbOn cauSht
【14】
in Proc findly
[填空题]请阅读下列程序代码,然后将程序的执行结果补充完整。
程序代码:
public class throwsExcepfion
static void Proc(int se1)
throws ArithmeticException,ArraylndexOutOfBoundsException
System.out.println("in Situation"+se1);
if(se1==0)
System.out.println("no Exception caught");
return;
else if(se1==1)
int iArray[]=new int[4];
iArray [1]=3;
public static void main(String args[])[
try
Proc(0);
Proc(1);
catch(ArraylndexOutOfBoundsException e)
System.out.println("Catch"+e);
finally
System.out.println("in Proc finally");
执行结果:
In Situation( )
no ExcepbOn cauSht
【14】
in Proc findly
[填空题]请阅读下列程序代码,然后将程序的执行结果补充完整。
程序代码:
public class throwsException
static void Proc(int sel)
throws ArithmeticException, ArrayIndexOutOfBoundsException
System.out.println("In Situation"+sel);
if(sel==0)
System.out.println("no Exception caught");
return;
else if(sel==1)
int iArray[]=new int[4];
iArray[1]=3;
public static void main(String args[])
try
Proc(0);
Proc(1);
catch (ArrayIndexOutOfBoundsException e)
System.out.println("Catch"+e);
finally
System.out.println("in Proc finally");
执行结果
In Situation 0
no Exception caught
【14】
in Proc finally
[填空题]请阅读下列程序代码,然后将程序的执行结果补充完整。
程序代码:
public class throwsException
static void Proc(intsel)
throws Arithmetic Exception,Array Index Out Of Bounds Exception
System.out.println("InSituation"+sel);
if(sel==0)
System.out.println("noException caught");
return;
else if(sel==1)
int iArray[]=newint[4];
iArray[-1]=3;
public static void main(String args[])
try
Proc(0);
Proc(1);
catch(Array Index Out Of Bounds Exception e)
System.out.println("Catch"+e);
finally
System.out.println("inProcfinally");
执行结果:
In Situation 0
no Exception caught
in Proc finally
[单项选择]请阅读下列程序代码,然后将程序的执行结果补充完整。横线处应填写的内容是______。
程序代码:
public class throwsException
static void Proe(intsel)
throws Arithmetic Exception, Array Index Out OfBounds Exception
System. out. println("InSituation"+sel);
if(sel==0)
System. out. println( "noExeeption caught")
return;
else if(sel==1)
int iArray[]=newint[4];
iArray[1]=3;
public static void main(String args[])
try
Proc(0);
Proc(1);
catch(Array Index Out Of Bounds Exception e)
System. out. println( "Catch"+e);
finally
System. out. println("inProcfinally");
执行结果:
In Situation 0
no Exception caught
______
in Proc finally
A. In Situation 1
B. In Situation
C. with Catch
D. int iArray 1
[简答题]阅读以下程序代码,写出程序的输出结果。
public class Class35
public static void main(String[] args)
String s1=new String("0860371"),s2="0860371";
System. out. println(s1==s2);
System. out. println(s1. equals(s2));
System. out. println(s1. endsWith(s2)==s1. startsWith(s2));
[简答题]阅读以下程序代码,写出程序的输出结果。
public class Class32
public static void main(String[] args)
boolean x=true,y=false,z=false;
x=x&&y||z;
y=x||y&&z;
z=!(x!=y)||(y==z);
System. out. println(x+","+y+","+z);
[简答题]阅读以下程序代码,写出程序的输出结果。
public class Class33
public static void main(String[] args)
int a,b,c;
a=b=c=1;
boolean w;
w=a++>1&&++b>c++:
System. out. println(a+","+b+","+c+","+w);
[单项选择]请阅读下面程序
public class ExampleStringBuffer
public static void main (String[]args)
StringBuffer sb=new StringBuffer("test");
System.out.printIn("buffer="+sb);
System, out.printIn("length="+sb.length( ));
程序运行结果中在“length=”后输出的值是______。
A. 10
B. 4
C. 20
D. 30
[单项选择]下列程序的执行结果是 public class Testff public static void main(String args[]) String sl=new String("I am boy"); String s2=new String("I am boy"); System.out.println(sl==s2);
A. true
B. false
C. "I am boy"
D. 都不正确
[单项选择]下列程序的执行结果是 public class Testhh public static void main(String args [] ) Strings1=new String("I am boy"); Strings2=new String("I am boy"); System.out.println(s1.equals(s2));
A. true
B. false
C. I am boy
D. 都不正确
[单项选择]请阅读下面程序
public class ForLoopStatement
public static void main (String[] args)
int i;j;
for(i=1;i<5;j++)//i循环
for(j=1;j<=i;j++)//j循环
System.out.print(i+"*"+j+"="+i*j+" ");
System.out.printIn( );
程序完成后,i循环和j循环执行的次数分别是______。
A. 4,10
B. 8,9
C. 9,8
D. 10, 10