GAUTAM
asked on
Creating a csv file from a map
Hi Experts...
I have a map of the type LinkedHashMap<String,Integ er> containing the students name and their marks as String and int data.
How do i create a csv file with the students name and their marks displayed one below the other with the header being two columns as Student and Marks.
Please help...
I have a map of the type LinkedHashMap<String,Integ
How do i create a csv file with the students name and their marks displayed one below the other with the header being two columns as Student and Marks.
Please help...
HahsMap<String, Integer> map = new HashMpa<Strng, Integer)();
map.add("Browm",5);
map.add("Jones",4);
PrintWriter out = new PrintWriter(new FileWriter("marks.csv"));
out.println("Students, Marks";
for(String s : map.keySet()){
out.println(s + "," + map.get(s));
}
out.close();
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@for_yan & @CEHJ:Thanks a lot for you replies.
ASKER
@for_yan & @CEHJ:Thanks a lot for your replies.
You are always welcome.
:)
Open in new window