麻烦老师检查下作业,谢谢
public static void main(String[] args) throws IOException { Buffered myBuffered = new Buffered(); myBuffered.transWriteByBuf(); myBuffered.transReadByBuf(); } private void transWriteByBuf() throws IOException { OutputStreamWriter outWriter = new OutputStreamWriter(new FileOutputStream("one.txt")); BufferedWriter bw = new BufferedWriter(outWriter); bw.write("你好吗?\n我很好"); bw.close(); outWriter.close(); } private void transReadByBuf() throws IOException { InputStreamReader reader = new InputStreamReader(new FileInputStream("one.txt")); BufferedReader br = new BufferedReader(reader); String str =null; while((str = br.readLine())!=null ) { System.out.println(str); } br.close(); reader.close(); }
22
收起
正在回答
1回答
同学你好,同学的代码符合题目要求,逻辑清晰,书写规范,做的很棒。
祝学习愉快~
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星