-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfileHand.java
More file actions
42 lines (33 loc) · 1.06 KB
/
fileHand.java
File metadata and controls
42 lines (33 loc) · 1.06 KB
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
import java.io.*;
import java.util.Scanner;
public class fileHand {
public static void main(String[] args) {
try {
BufferedWriter out = new BufferedWriter(new FileWriter("outagain.txt"));
Scanner userInput = new Scanner(System.in);
String input;
while (!(input = userInput.nextLine()).isEmpty()) {
out.write(input);
out.newLine();
input = null;
}
userInput.close();
out.close();
} catch (IOException e) {
System.out.println(e);
}
try {
BufferedReader br = new BufferedReader(new FileReader("outagain.txt"));
String st;
while ((st = br.readLine()) != null) {
String[] str = st.split(" ");
for (int i = 0; i < str.length; i++) {
System.out.println(str[i] + "\\\\");
}
}
br.close();
} catch (IOException e) {
System.out.println(e);
}
}
}