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
2 Antworten
0
You are looking for CSV (comma separated values) file handling.
https://www.csvreader.com/java_csv_samples.php
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
}
}