计算机等级考试二级Java模拟试题10
发布时间:2010/11/15 12:00:23 来源:www.xue.net 编辑:城市总裁吧
10.线程在生命周期中要经历 5 种状态,分别是新建状态、可运行状态、运行状态、____状
态和终止状态。
输入答案,中间不含空格:
11.FileInputStream 是字节流;BufferedWriter 是字符流;ObjectOutputStream 是____。
输入答案,中间不含空格:
12.break 语句最常见的用法是 switch 语句中,通过 break 语句退出 switch 语句,
使程序从整个 switch 语句后面的____开始执行。
输入答案,中间不含空格:
13.请阅读下列程序代码,然后将程序的执行结果补充完整。
程序代码:
public class throwsException{
static void Proc(int sel)
throw 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 Situation0
no Exception caught
____
in Proc finally
输入答案,中间不含空格:
14.当使用 Thread t=new Thread(r)创建一个线程时,表达式:r instanceof Thread 的
值是____
输入答案,中间不含空格: