import java.io.* ;
public class TestBufferedStream {
public static void main(String args[]) {
try {
BufferedReader br = new BufferedReader(new FileReader("F:\\java\\IO\\TestRandom.txt"));//为什么没有对象的申明无法在硬盘上创建这个TestRandom.txt这个文件?
BufferedWriter bw = new BufferedWriter(new FileWriter("F:\\java\\IO\\TestRandom.txt"));
for(int i=0;i<10;i++) {
String s = String.valueOf(Math.random());
bw.write(s);
bw.newLine();
}
bw.flush();
bw.close();
String s = null;
while((s= br.readLine())!=null) {
System.out.println(s);
}
br.close();
}catch(IOException e) {
System.out.println("file read error");
}
}
}