csvfile.java
import java.io.IOException;
import java.util.Arrays;
import java.util.stream.Stream;
import java.util.stream.Collectors;
import java.nio.file.Files;
import java.nio.file.Paths;
class csvfile {
public static void main(String args[]) {
// read from csv file
try (Stream<String> stream = Files.lines(Paths.get(System.getProperty("user.dir"),args[0]))) {
// read each line
String data[][] = stream.map(line -> line.split(","))
.map(line -> Arrays.stream(line)
.map(String::new)
.toArray(String[]::new))
.toArray(String[][]::new);
//debug
//System.out.println(data[0][0]+data[0][1]+data[0][2]);
} catch (IOException e) {
e.printStackTrace();
}
}
}