i wrote a code that takes a line from a txt file, splits it into different strings and integers and then stores it into an array list as an object called professor. The code of the main class its this:
public class Main {
    public static void main(String[] args) throws IOException {
        FileReader file = new FileReader("text.txt");
        BufferedReader reader = new BufferedReader(file);
        ArrayList<Profesor>professors = new ArrayList<Profesor>();
        String line = reader.readLine();
        String[] lineSplit = new String[11];
        while(line != null){
            lineSplit = line.split("\\s+");
            professors.add(new Profesor(lineSplit[0], lineSplit[1], Integer.parseInt(lineSplit[2]), Integer.parseInt(lineSplit[3]), Integer.parseInt(lineSplit[4]), Integer.parseInt(lineSplit[5]), Integer.parseInt(lineSplit[6]), Integer.parseInt(lineSplit[7]), Integer.parseInt(lineSplit[8]), Integer.parseInt(lineSplit[9]), Integer.parseInt(lineSplit[10]), Integer.parseInt(lineSplit[11])));                     
        }
    }
}
And the Profesor class its:
public class Profesor {
    private String name;
    private String subject;
    private int wh0;
    private int wh1;
    private int wh2;
    private int wh3;
    private int wh4;
    private int wh5;
    private int wh6;
    private int wh7;
    private int wh8;
    private int wh9;    
    public Profesor(String n, String s, int w0, int w1, int w2, int w3, int w4, int w5, int w6, int w7, int w8, int w9){
        name = n;
        subject = s;
        wh0 = w0;
        wh1 = w1;
        wh2 = w2;
        wh3 = w3;
        wh4 = w4;
        wh5 = w5;       
        wh6 = w6;
        wh7 = w7;
        wh8 = w8;
        wh9 = w9;               
    }
}
And the txt file its something like:
Jhon Maths 173 486 789 954 684 235 446 168 749 851   
Robert MathsII 283 686 948 978 144 224 473 468 778 845
The question its how can I display the arraylist into the console?
and how do I access a string inside one of the objects inside of the arraylist?
Thanks in advance
 
     
     
    