-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuffered.java
45 lines (34 loc) · 982 Bytes
/
Buffered.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import java.io.*;
import javax.annotation.processing.FilerException;
class BFWR {
public static void main(String[] args) throws IOException {
// BUFFEREDWRITER
File f = new File("bfr.txt");
FileWriter fw = new FileWriter(f, true);
BufferedWriter bw = new BufferedWriter(fw);
bw.write(97);
bw.newLine();
bw.write(98);
bw.newLine();
bw.write('a');
bw.newLine();
bw.write("Ishan");
bw.newLine();
bw.write("Shah");
bw.newLine();
char[] ch = { 'a', 'b', 'c' };
bw.write(ch);
bw.newLine();
bw.flush();
bw.close();
// BUFFEREDREADER
File f1 = new File("bfr.txt");
FileReader fr = new FileReader(f1);
BufferedReader br = new BufferedReader(fr);
String s = br.readLine();
while (s != null) {
System.out.println(s);
s = br.readLine();
}
}
}