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

Im trying to import a CSV file into an array or 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!