public static void main(String[] args) throws IOException {
BufferedWriter bw = new BufferedWriter(
new FileWriter("C:/Users/宇超/Desktop/rand.txt"));
BufferedReader br = new BufferedReader(
new FileReader("C:/Users/宇超/Desktop/rand.txt"));
for (int i = 0; i < 50; i++) {
bw.write(String.valueOf(Math.random()));
bw.newLine();
}
bw.flush();
bw.close();
String str = null;
while((str=br.readLine())!=null){
System.out.println(str+"\n");
}
br.close();
}
时间: 2024-10-07 01:34:25