Question: Im trying to import a CSV file into an array or list. I dont if i should import it into an array then copy to
Im trying to import a CSV file into an array or list. I dont if i should import it into an array then copy to a list or just directly copy it into the list

Scanner scan = new Scanner((System.in)); System.out.println("What is the file path?"); // take in csv file String CSVpath = scan.nextLine(); String line; try{ BufferedReader readCSV = new BufferedReader(new FileReader(CSVpath)); while((line = readCSV.readLine()) != null) { String[] CSV_values = line.split(","); //splits array by commas } } catch (FileNotFoundException fileNotFoundException) { fileNotFoundException.printStackTrace(); } catch (IOException ioException) { ioException.printStackTrace(); } Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
