用“new FileOutputStream(“data.txt”,true)”创建一个 FileOutputStream 实例对象,则下面( )说法是正确的。
举一反三
- 面那些选项能够创建一个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“);
- 下面创建的输入或输出流对象( )能读或写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”);
- 下面创建的输入或输出流对象哪个能读或写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”));
- 要在磁盘上创建一个文件,可以使用哪些类的实例 A: File B: FileOutputStream C: RandomAccessFile D: 以上都对
- 下列写法错误的是 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 ("."));