「java入門」CSVファイルを読み込むサンプルコード

javaコード:
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.*;

public class CsvReadFile{
public static void main(String[] args) {
Hashtable<String, String[]> chang = new Hashtable<String, String[]>();
try {
BufferedReader reader = new BufferedReader(new FileReader(“wanfg.csv”));
String line = null;
while((line=reader.readLine())!=null){
String item[] = line.split(“,”);
String item2[] = new String[19];
System.arraycopy(item,1,item2,0,19);
chang.put(item[0],item2);
}
Enumeration e2 = chang.keys();
while (e2.hasMoreElements()) {
String key = (String) e2.nextElement();
System.out.println(key);
String[] pk = (String[])chang.get(key);
for (int i=0;i<pk.length;i++) {
System.out.print(pk[i]+”\t”);
}
System.out.println();
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}