单项选择(2008年4月二级考试)

在Java中,“目录”被看作是【 】

A、文件

B、流

C、数据

D、接口

答案解析

A

【解析】

 Java中的文件和目录都看成文件,可通过File类的idDirectory()和isFile()方法判断某个File是目录还是标准文件。

讨论

在Java 中,对象流以____________方法传送和存储。

Java 输入/输出流中包括字节流、____________、文件流、对象流以及管道流。

下列程序的运行结果是 【 】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{             testd=new test();             d.fun();         }catch(Exception e){             System.out.printIn(“error2”);         }     } }

下列代码的执行结果是 【 】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+2]/x[i]+x[i+1]);             }catch(ArithmeticException e){                 System.out.println("error1");             }catch(Exception e){                 System.out.println("error2");             }         }     } }

在oneMethod()方法运行正常的情况下,程序段将输出什么? public void test(){   try{    oneMethod();    System.out.println("condition 1");   }catch(ArrayIndexOutOfBoundsException e){    System.out.println("condition 2");   }catch(Exception e){    System.out.println("condition 3");   }finally{    System.out.println("finally");   } }

Java的类库中提供Throwable类来描述异常,它有Error和 __________ 两个直接子类。

下列常见的系统定义的异常中,哪个是输入/输出异常【 】

Java语言对简单数据类型进行了类包装,int对应的包装类是__________。

下列叙述中,错误的是【 】

接口中,除了抽象方法之外,还可以含有【 】

在Java 中,对象流以____________方法传送和存储。

Java 输入/输出流中包括字节流、____________、文件流、对象流以及管道流。

下列程序的运行结果是 【 】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{             testd=new test();             d.fun();         }catch(Exception e){             System.out.printIn(“error2”);         }     } }

下列代码的执行结果是 【 】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+2]/x[i]+x[i+1]);             }catch(ArithmeticException e){                 System.out.println("error1");             }catch(Exception e){                 System.out.println("error2");             }         }     } }

在oneMethod()方法运行正常的情况下,程序段将输出什么? public void test(){   try{    oneMethod();    System.out.println("condition 1");   }catch(ArrayIndexOutOfBoundsException e){    System.out.println("condition 2");   }catch(Exception e){    System.out.println("condition 3");   }finally{    System.out.println("finally");   } }

Java的类库中提供Throwable类来描述异常,它有Error和 __________ 两个直接子类。

下列常见的系统定义的异常中,哪个是输入/输出异常【 】

Java语言对简单数据类型进行了类包装,int对应的包装类是__________。

下列叙述中,错误的是【 】

接口中,除了抽象方法之外,还可以含有【 】

在Java 中,对象流以____________方法传送和存储。

Java 输入/输出流中包括字节流、____________、文件流、对象流以及管道流。

下列程序的运行结果是 【 】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{             testd=new test();             d.fun();         }catch(Exception e){             System.out.printIn(“error2”);         }     } }

下列代码的执行结果是 【 】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+2]/x[i]+x[i+1]);             }catch(ArithmeticException e){                 System.out.println("error1");             }catch(Exception e){                 System.out.println("error2");             }         }     } }

在oneMethod()方法运行正常的情况下,程序段将输出什么? public void test(){   try{    oneMethod();    System.out.println("condition 1");   }catch(ArrayIndexOutOfBoundsException e){    System.out.println("condition 2");   }catch(Exception e){    System.out.println("condition 3");   }finally{    System.out.println("finally");   } }

Java的类库中提供Throwable类来描述异常,它有Error和 __________ 两个直接子类。

下列常见的系统定义的异常中,哪个是输入/输出异常【 】

Java语言对简单数据类型进行了类包装,int对应的包装类是__________。

下列叙述中,错误的是【 】

接口中,除了抽象方法之外,还可以含有【 】