| 13 | */ |
| 14 | public class BufferedDemo { |
| 15 | public static void main(String[] args) throws IOException { |
| 16 | // ��� |
| 17 | // BufferedWriter bw = new BufferedWriter(new FileWriter("bw.txt")); |
| 18 | // for (int x = 0; x < 10; x++) { |
| 19 | // bw.write("hello" + x); |
| 20 | // bw.newLine(); |
| 21 | // bw.flush(); |
| 22 | // } |
| 23 | // bw.close(); |
| 24 | |
| 25 | // ��ȡ���� |
| 26 | BufferedReader br = new BufferedReader(new FileReader("bw.txt")); |
| 27 | |
| 28 | // String s = br.readLine(); |
| 29 | // System.out.println(s); |
| 30 | // s = br.readLine(); |
| 31 | // System.out.println(s); |
| 32 | |
| 33 | String line = null; |
| 34 | while ((line = br.readLine()) != null) { |
| 35 | System.out.println(line); |
| 36 | } |
| 37 | |
| 38 | br.close(); |
| 39 | } |
| 40 | } |