so I am trying to read and split the following data up into an array. However, the txt file only has one line.
1, 5, 3, 7, 9, 5, 3, 1, 9, 5, 7, 3, 7, 5, 9, 1, 3, 5
And I am not sure if I am correctly doing it with my code.
try {
File cars = new File("cars.txt");
Scanner myReader = new Scanner(cars);
String data = myReader.nextLine();
while (myReader.hasNextLine()) {
data = myReader.nextLine();
String values[] = data.split(",");
System.out.print(values);
}