-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKeepScore.java
More file actions
30 lines (26 loc) · 793 Bytes
/
KeepScore.java
File metadata and controls
30 lines (26 loc) · 793 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
26
27
28
29
30
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Scanner;
import java.io.FileWriter;
/**
* RecordingKeeping
*/
public class KeepScore {
public static void main(String[] args) {
WriteToFile(args[0]);
}
public static void WriteToFile(String filename){
try {
FileWriter mywriter = new FileWriter(filename, true);
String score = "35";
mywriter.write(score);
mywriter.close();
System.out.println("Successfully written inside the file");
} catch (IOException e) {
// TODO: handle exception
System.out.println("An error occurred");
e.printStackTrace();
}
}
}