This question has had me working for hours so I would immensely appreciate any help. I need to read in a file through command line argument that contains name, major, ID, and graduation date of multiple students. Then, I need to store this information in an array, and use this array to output just the information of specific students that satisfy a condition (they will graduate in 2017). So essentially I'm outputting a new file that only contains students that match this condition.
I've created this code to read in a file and store them to an array. But from here, I am stumped :(
Please, any help would be valuable.
import java.util.*;
import java.io.*;
import java.io.File;
public class Aid {
public static void main(String[] args) throws IOException {
String token1 = "";
Scanner inFile1 = new Scanner(new File("location of file in my folder")).useDelimiter(",\\s*");
List<String> temps = new ArrayList<String>();
while (inFile1.hasNext()) {
token1 = inFile1.next();
temps.add(token1);
}
inFile1.close();
String[] tempsArray = temps.toArray(new String[0]);
for (String s : tempsArray) {
System.out.println(s);
}
}
}