This code is to get the firstName, LastName, and StudentID by reading it from a file and displaying the information in the main file. When I run my program, instead of printing the information of the students, it prints out a chain of characters and numbers.
public class main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        Student[] students = new Student[10];
        getStudentData(students);
        for (int i = 0; i < students.length; i++){
            System.out.println(students[i]);
        }
    }
    public static void getStudentData(Student[] students){
        String infileName = "studentlist.txt";
        Scanner reader = null;
        try {
            reader = new Scanner (new File(infileName));
            int index = 0;
            while(reader.hasNext()){
                String oneLine = reader.nextLine();
                String[] parts = oneLine.split(" ");
                long studentID = Long.parseLong(parts[2]);
                students[index] = new Student(parts[0],parts[1],studentID);
                index++;
            }
        } catch (FileNotFoundException err) {
            System.out.println(err);
        } finally {
            if (reader != null)
                reader.close();
        }
    }
}
 
    