JavaSE BufferReaderDemo
package com.sxt;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
/**
* 缓存字符流
*
* @author Administrator
*
*/
public class BufferReaderDemo {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new FileReader("c:/aaa.txt"));
String s = "";
while ((s = br.readLine()) != null) {
System.out.println(s);
}
br.close();
BufferedWriter bw = new BufferedWriter(new FileWriter("c:/a.txt"));
bw.write("我是王二");
bw.newLine();
bw.write("我今年20岁");
bw.close();
}
}
本文标题:JavaSE BufferReaderDemo
本文链接:https://www.haomeiwen.com/subject/ssaekftx.html
网友评论