-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSem2_T3_10.java
More file actions
25 lines (23 loc) · 759 Bytes
/
Copy pathSem2_T3_10.java
File metadata and controls
25 lines (23 loc) · 759 Bytes
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
import java.io.*;
public class Sem2_T3_10 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new FileReader("Sample1.txt"));
BufferedWriter bw = new BufferedWriter(new FileWriter("abab.txt"));
String l = br.readLine();
while (l != null) {
String w[] = l.split(" ");
for (String x : w) {
if(x.equals("hi")) {
bw.write("hello ");
} else {
bw.write(x + " ");
}
}
bw.newLine();
// bw.flush();
l = br.readLine();
}
bw.flush();
br.close(); bw.close();
}
}