【发布时间】:2013-12-04 15:25:11
【问题描述】:
我是 java 新手,我需要使用 opencsv 项目读取 csv 文件。请指导我在哪个文件中以及我必须将代码放在哪里:
CSVReader reader = new CSVReader(new FileReader("yourfile.csv"));
String [] nextLine;
while ((nextLine = reader.readNext()) != null) {
// nextLine[] is an array of values from the line
System.out.println(nextLine[0] + nextLine[1] + "etc...");
}
非常感谢, 问候, 费萨尔
【问题讨论】:
-
您是否有一些现有的项目要将其集成到其中?如果是这样,请将代码放在那里。否则,编写一个自己的小型 java 类并将代码放在那里。