题目内容

以下选项中,哪个是FileInputStream的父类( )

A. File
B. FileOutputStream
C. OutputStream
D. InputStream

查看答案
更多问题

阅读下段代码import java.io.*;public class Example{public static void main(String[] args) throws Exception { FileInputStream fis = new FileInputStream("file.txt");FileOutputStream fos = new FileOutputStream("copy_file.txt");int ch = 0;while((ch =fis.read())!=-1){fos.write(ch);}fos._______;fis.close(); }}下列选项中,哪个填写在程序的空白处,程序不会报错。

A. read()
B. available()
C. close()
D. write()

阅读下列代码import java.io.*;public class Example{ public static void main(String[] args) throws Exception {// 创建一个带缓冲区的输入流BufferedInputStream bis = new BufferedInputStream(new ________("src.txt"));// 创建一个带缓冲区的输出流BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("des.txt"));int len;while ((len = bis.read()) != -1) {bos.write(len);}bis.close();bos.close(); }}下列选项中,可以填写在程序空白处的是()

A. FileInputStream
B. File
C. InputStream
D. 以上答案都不正确

阅读下段代码import java.io.*;public class Example { public static void main(String[] args) throws Exception {byte[] bufs = new byte[] { 97, 98, 99, 100 };// 创建一个字节数组ByteArrayInputStream bis = new ByteArrayInputStream(bufs);//读取字节数组中的数据//下面的代码是循环读取缓冲区中的数据 int b;while ((b = bis.read()) != -1) {System.out.print((char) b+",");} }}下列选项中,哪一个是程序的运行结果( )

A. 97,98,99,100,
B. 100,99,98,97,
C. a,b,c,d,
D. A,B,C,D,

阅读下列代码import java.io.*;public class Example{public static void main(String[] args) throws Exception {OutputStream out = new FileOutputStream("itcast.txt ", true);String str = "欢迎你!";byte[] b = str.getBytes();for (int i = 0; i < b.length; i++) {out.______(b[i]);}out.close(); }}下列选项中,哪个填写在程序空白处会使程序正确。

A. read()
B. write()
C. close()
D. available()

答案查题题库