Wednesday, January 29, 2014

Java program to read csv file

Below is the java program to read a csv file.

Lets assume we have a below csv file.

Country.csv

"Country","Capital","President"
"India","Delhi","Pranab Mukherjee"
"United Kingdom","London","David Cameron"
"China","Beijing","Hu Jintao"
"United States","Washington","Barack Obama"

CSVReader.java


Output

"Country" "Capital" "President"
"India" "Delhi" "Pranab Mukherjee"
"United Kingdom" "London" "David Cameron"
"China" "Beijing" "Hu Jintao"
"United States" "Washington" "Barack Obama" 

No comments:

Post a Comment