下面创建的输入或输出流对象哪个能读或写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: 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”));
举一反三
- 下面创建的输入或输出流对象( )能读或写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: 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"));
- 要读一个较大的文件,下列创建对象的方法中哪个是最合适的?( ) A: new FileInputStream(“myfile.dat”); B: new InputStreamReader(new FileInputStream(“myfile.dat”)); C: new BufferedReader(new InputStreamReader(new FileInputStream(“myfile.dat”); D: new RandomAccessFile raf=new RandomAccessFile(new File(“myfile.dat”,”rw”));
- 新建一个流对象,下列( )选项的代码是错误的。 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"));
- 在下列Java代码中,会出现编译错误的是( )。 A: File f=new File(“/”,”1.dat”); B: DataInputStream din=new DataInputStream(new FileInputStream(“1.dat”) ); C: InputStreamReader in=new InputStreamReader(System.in); D: OutputStreamWriter out=new OutputStreamWriter(System.in);