下面创建的输入或输出流对象( )能读或写Java的原始数据类型。
A: FileOutputStream fos = new FileOutputStream (“abc.dat”);
B: DataOutputStream out = new DataOutputStream (fos);
C: RandomAccessFile raf = new RandomAccessFile (“Class1.java”, ”rw”);
D: FileOutputStream out = new FileOutputStream (“. / temp/ abc.txt”);
A: FileOutputStream fos = new FileOutputStream (“abc.dat”);
B: DataOutputStream out = new DataOutputStream (fos);
C: RandomAccessFile raf = new RandomAccessFile (“Class1.java”, ”rw”);
D: FileOutputStream out = new FileOutputStream (“. / temp/ abc.txt”);
举一反三
- 下面创建的输入或输出流对象哪个能读或写Java语言中的double类型的数据 A: FileOutputStream fos=new FileOutputStream("1.dat"); B: DataOutputStream out=new DataOutputStream(new FileOutputStream(“2.dat”)); C: RandomAccessFile raf = new RandomAccessFile("3.java" , "rw" ); D: DataInputStream in=new DataInputStream(new FileInputStream(“4.dat”));
- 面那些选项能够创建一个OutputStream流,并且可以将内容附加到“file.txt”文件中 A: OutputStream out=new FileOutputStream(“file.txt“); B: OutputStream out=new FileOutputStream(“file.txt“,”append”); C: OutputStream out=new FileOutputStream(“file.txt“,true); D: OutputStream out=new FileOutputStream(“file.txt“);
- 下列写法错误的是 A: File f = new File ("a.txt"); B: File f = new File ("d:\\a.txt"); C: FileInputStream fis = new FileInputStream (new File ("a.txt")); D: FileOutputStream fos = new FileOutputStream ( File ("."));
- 新建一个流对象,下列( )选项的代码是错误的。 A: new BufferedWriter(new FileWriter("a.txt")); B: new BufferedReader(new FileInputStream("a.dat")); C: new DataOutputStream(new FileOutputStream("a.txt")); D: new ObjectInputStream(new FileInputStream("a.dat"));
- 用“new FileOutputStream(“data.txt”,true)”创建一个 FileOutputStream 实例对象,则下面( )说法是正确的。