Simple Code To Read CSV file – JAVA

it’s very simple to read CSV and then get all information by columns this is simple code which will help you with it

try {
BufferedReader br = new BufferedReader(new FileReader("./customer-list.csv"));
  while ((line = br.readLine()) != null) {
   if (!line.isEmpty()) {
    // use comma as separator
    String[] data = line.split(",");
    //data[0] contains first column if you want second one use data[1] and so on
    System.out.println(data[0]);
}
}
 
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}

Skip First line with FileReader – Java

Example how to skip first line of any file which you want to read using FileReader in Java

        BufferedReader br = new BufferedReader(new FileReader("./test.csv"));
 
        br.readLine();
        while ((line = br.readLine()) != null) {
            if (!line.isEmpty()) {
                // use comma as separator
                String[] data = line.split(",");
            }
        }

all what we are doing is adding br.readLine(); before while loop this will read first line so it will be skipped in loop.