Which constructs a DataOutputStream?()
第1题:
A、InputStream in=new FileReader(“file.txt”)
B、InputStream in=new FileInputStream(“file.txt”)
C、InputStream in=new InputStreamFileReader (“file.txt”,“read”)
D、FileInputStream in=new FileReader(new File(“file.txt”))
第2题:
阅读下面写文件的程序 import java. io. *; public class WriteFile{ public static void main(String[]A) { int[]myArray={10,20,30,40}; try{ FileOutputStream f=new FlieOutStream("ints. dat"); DataOutputStream______=new DataOutputStream(f); for(int i=0; i<myArray. length; i ++) dos. writeInt(myArray[i]); dos. close(); System. out. prinfln("Have written binary file ints. dat"); } catch(IOException ioe){ System. out. println("IO Exception"); } } 在程序下画线处填入的正确选项是
A.myArray
B.dos
C.ioe
D.ints
第3题:
下面创建一个新文件对象方法错误的是( )。
A.File myFile; myFile=new File("mulu/file");
B.File myFile=new File();
C.myFile=new FileC/mulu","filel");
D.File myDir=new file("/mulu"); myFile=new File(Dir, "filer');
第4题:
创建一个向文件“file.txt”追加内容的输出流对象的语句有()。
第5题:
( 20 ) 下列程序的功能是将一个整数数组写入二进制文件 。 在程序的下划线处应填入的选项是
import java.io.*;
public class XieShuzu{
public static void main(String[] a){
int [] myArray={10,20,30,40};
try{
DataOutputStream dos=
new DataOutputStream(new FileOutputStream( " ints.dat " ));
for(int i=0;i<myArray.lenth;i++)
dos. _______(myArray[i]);
dos.close();
System.out.println( " 已 经 将 整 数 数 组 写 入 二 进 制 文 件 :
ints.dat " );
}catch(IOException ioe)
{System.out.println( " IO Exception " );}
}
}
A ) writeArray
B ) writeByte
C ) writeInt
D ) writeDouble
第6题:
A.Compilation fails.
B.Nothing is added to the file system.
C.Only a new file is created on the file system.
D.Only a new directory is created on the file system.
E.Both a new file and a new directory are created on the file system.
第7题:
A. mv /old_dir/file /new_dir
B. mv -p /old_dir/file /new_dir
C. mv -k /old_dir/file /new_dir
D. mv /old_dir/file /new_dir/new_file
第8题:
阅读下面程序
import java.io.*;
public class ByteStream Test{
public static void main(String[] a){
int[] myArray = {10,20.30,40};
try{
DataOutputStream dos = new DataOutputStream
(new _________________( " ints.dat " ));
for (int i=0;i<myArray.length;i++)
dos.writeInt(myArray[i] ) ;
dos.close();
S ystem.out.println( " Have written binary file ints.dat " );
}
catch (IOException ioc){
System.out.println( " IO Exception " );
}
}
}
为保证程序正确运行,在程序中下划线处应填入的代码是
A)FileOutputStream
B)ByteArrayOutputStream
C)BufferedOutputStream
D)FileWriter
第9题:
欲新建一个电路原理图文件应该执行()操作。
第10题:
在J2EE中,在提供名为sock的套节字实例的前提下,为了获取通过套节字进行通信的输出流,你可以编写()。