forked from txs72/JavaTutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWriteData.java
More file actions
executable file
·33 lines (29 loc) · 884 Bytes
/
WriteData.java
File metadata and controls
executable file
·33 lines (29 loc) · 884 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
31
32
33
/* */ package ch12_io;
import java.io.File;
import java.io.PrintWriter;
/* */
/* */ public class WriteData {
/* */ public static void main(String[] args) throws Exception {
/* 5 */ File file = new File("scores.txt");
/* 6 */ if (file.exists()) {
/* 7 */ System.out.println("File already exists");
/* 8 */ System.exit(0);
/* */ }
/* */
/* */
/* 12 */ PrintWriter output = new PrintWriter(file);
/* */
/* */
/* 15 */ output.print("John T Smith ");
/* 16 */ output.println(90);
/* 17 */ output.print("Eric K Jones ");
/* 18 */ output.println(85);
/* */
/* */
/* 21 */ output.close();
/* */ }
/* */ }
/* Location: /Volumes/TXS.128G/hope useful/practice/2020.jar!/ch12_io/WriteData.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/