-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWritingToCSV.java
More file actions
41 lines (33 loc) · 1.01 KB
/
WritingToCSV.java
File metadata and controls
41 lines (33 loc) · 1.01 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
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
public class WritingToCSV {
public static void main(String[] args) {
try (PrintWriter writer = new PrintWriter(new File("data.csv"))) {
StringBuilder sb = new StringBuilder();
sb.append("Employee Name");
sb.append(',');
sb.append("Employee Number");
sb.append (',');
sb.append ("Gender");
sb.append (',');
sb.append ("Date Of Birth");
sb.append (',');
sb.append ("Email Id");
sb.append (',');
sb.append ("Address");
sb.append (',');
sb.append ("Higher Qualification");
sb.append (',');
sb.append ("Department");
sb.append (',');
sb.append ("Hobby");
sb.append (',');
sb.append ("Extra-Curricular activities");
writer.write(sb.toString());
} catch (FileNotFoundException e) {
System.out.println(e.getMessage());
}
}
}
//code written by popeye :)