logo - 刷刷题
下载APP
【简答题】

以下程序实现读写文件的功能,请把_________上的语句填写完整。import java.io.*; public class ioTest { public static void main(String args[]) { //首先,基于字节输出流FileOutputStream向文件中写入数据 try { FileOutputStream fout= new FileOutputStream(new File("d:/my.txt")); fout.write("2017122108 男 王晓飞 计算机计171 江苏苏州".getBytes()); fout.close(); //关闭输出流 } catch(IOException e) { } //接下来,基于字节输入流FileInputStream,将文件中的信息读出并显示 try { FileInputStream fin=new FileInputStream(new File("d:/my.txt")); byte[] data=new byte[200];//接收从文件中读到的数据 int n;//n为实际读到的字节数 while((n=fin.read(__________))!=-1) { String s=new String(data,0,n);//将读到的数据拼成字符串 System.out.println(s);//输出 } } catch(IOException ex) { } } }

举报
参考答案:
参考解析:
.
刷刷题刷刷变学霸
举一反三