Read each name in Array list to create seperate object for

I have a file that has student names, age, and an id number. I have a student class that holds the everything above for each student object. I stored all the names, id numbers. and age separately in an array list. Now im trying to assign the info to create a student object.

public class Student {
    private String lName;
    private int idNumber;
    private int age;

    public Student() {
        lName = "";
        idNumber = 0;
        age = 0;
    public Student(String l, int i, int a) {
        lName = l;
        idNumber = i;
        age = a;

    public void setName(String last) {
        lName = last;

    public String getName() {
        return lName;

    public void setIdNum(int num) {
        idNumber = num;

    public int getIdNum() {
        return idNumber;

    public void setAge(int a) {
        age = a;

    public int getAge() {
        return age;

My Text File looks something like this: This info is stored in parallel array lists. I don't quite get how to implement this into an object to pass it into my second contractor method.

  Josh          2134         19
  Smith         5256         21
  Rogers        9248         19
  Andrew        7742         20

Here's what I've tried;

public static void main(String[] args) {
    String file = "studentData.txt";
    Scanner reader = new Scanner(file);

    ArrayList<String> lastNames = lNames(file);
    ArrayList<Integer> idNumbers = idNum(file);
    ArrayList<Integer> ageList = ages(file);

    Scanner input = new Scanner(;

    Student s1 = new Student();

    // confused about how to implement this constructor with the textile info
    for (int i = 0; i<idNumbers.size(); i++) {
        Student user = new Student(lastNames.get(i), idNumbers.get(i), ageList.get(i));

    //user enters idNumber to display age
    System.out.println("Enter ID Number"); //exception handling to be added
    int idNum = input.nextInt();

    for (int i = 0; i<idNumbers.size(); i++) {
        if (idNum == idNumbers.get(i)) {

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum