服务热线:13616026886

技术文档 欢迎使用技术文档,我们为你提供从新手到专业开发者的所有资源,你也可以通过它日益精进

位置:首页 > 技术文档 > JAVA > 新手入门 > 基础入门 > 查看文档

scjp认证套题解析之十一


   51、which is not a method of the class inputstream?
   a. int read(byte[])
   b. void flush()
   c. void close()
   d. int available()
   (b)
   题目:下面哪个不是inputstream类中的方法

   这个题目没有什么好说的,要求熟悉java api中的一些基本类,题目中的inputstream是所有输入流的父类,所有要很熟悉,参看jdk的api文档。方法void flush()是缓冲输出流的基本方法,作用是强制将流缓冲区中的当前内容强制输出。

   52、which class is not subclass of filterinputstream?
   a. datainputstream

   b. bufferedinputstream

   c. pushbackinputstream

   d. fileinputstream

   (d)

   题目:
   哪个不是filterinputstream的子类。

   此题也是要求熟悉api基础类。java基础api中的filterinputstream 的已知子类有:bufferedinputstream, checkedinputstream, cipherinputstream, datainputstream, digestinputstream, inflaterinputstream, linenumberinputstream, progressmonitorinputstream, pushbackinputstream 。

   53、which classes can be used as the argument of the constructor of the class
fileinputstream?
   a. inputstream

   b. file

   c. fileoutputstream

   d. string

   (bd)

   题目:哪些类可以作为fileinputstream类的构造方法的参数。

   此题同样是要求熟悉基础api,fileinputstream类的构造方法有三个,可接受的参数分别是:file、filedescriptor、string类的一个对象。

   54、which classes can be used as the argument of the constructor of the class filterinputstream?
   a. filteroutputstream

   b. file

   c. inputstream

   d. randomaccessfile

   (c)

   题目:哪些类可以作为filterinputstream类的构造方法的参数。

   filterinputstream的构造方法只有一个,其参数是一个inputstream对象。

   55、given the following code fragment:
   1) switch(m)

   2) { case 0: system.out.println("case 0");

   3) case 1: system.out.println("case 1"); break;

   4) case 2:

   5) default: system.out.println("default");

   6) }
   which value of m would cause "default" to be the output?
   a. 0

   b. 1

   c. 2

   d. 3

   (cd)

   题目:给出下面的代码片断:
   …
   m为哪些值将导致"default"输出。

   此题考察switch语句的用法,switch的判断的条件必须是一个int型值,也可以是byte、short、char型的值,case中需要注意的是一个case后面一般要接一个break语句才能结束判断,否则将继续执行其它case而不进行任何判断,如果没有任何值符合case列出的判断,则执行default的语句,default是可选的,可以没有,如果没有default而又没有任何值匹配case中列出的值则switch不执行任何语句。

扫描关注微信公众号