Commit 2d8e6c3e by 傅伟强-富德

Update Test.java

1 parent 9b4b6042
Showing with 4 additions and 4 deletions
...@@ -25,7 +25,7 @@ public class Test { ...@@ -25,7 +25,7 @@ public class Test {
try { try {
fileName.createNewFile(); fileName.createNewFile();
BufferedWriter bWriter=new BufferedWriter(new FileWriter(fileName)); BufferedWriter bWriter=new BufferedWriter(new FileWriter(fileName));
bWriter.write("哈哈哈哈"); bWriter.write("哈哈哈哈呵呵呵呵");
bWriter.flush(); bWriter.flush();
bWriter.close(); bWriter.close();
} catch (IOException e) { } catch (IOException e) {
...@@ -35,12 +35,12 @@ public class Test { ...@@ -35,12 +35,12 @@ public class Test {
InputStreamReader reader = new InputStreamReader( InputStreamReader reader = new InputStreamReader(
new FileInputStream(fileName)); // 建立一个输入流对象reader new FileInputStream(fileName)); // 建立一个输入流对象reader
BufferedReader br = new BufferedReader(reader); // 建立一个对象,它把文件内容转成计算机能读懂的语言 BufferedReader br = new BufferedReader(reader); // 建立一个对象,它把文件内容转成计算机能读懂的语言
String line = ""; String line = "";
line = br.readLine(); line = br.readLine();
while (line != null) { while (line != null) {
line = br.readLine(); // 一次读入一行数据 line = br.readLine(); // 一次读入一行数据
} }
System.out.println(line); System.out.println(line);
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!