0

What code would i require if i wanted to read in external files? Into an array while using comma as a method to split the content from the file

4th Feb 2017, 10:00 PM
Fateen Ahmad
Fateen Ahmad - avatar
2 Antworten
0
You are looking for CSV (comma separated values) file handling. https://www.csvreader.com/java_csv_samples.php
4th Feb 2017, 10:15 PM
seamiki
seamiki - avatar
0
try (BufferedReader br = new BufferedReader(new FileReader(new File(filename)))) { String line; while ((line = br.readLine()) != null) { String[] array = line.split(","); //here do whatever you want with the array elements } }
5th Feb 2017, 1:58 AM
Edward