title: How to input the data from a txt file into a arraylist. Involving multiple data types and class objects that are variables for other classes
body: <p>I'm reading in data from different txt files to make objects and then into arraylists of the objects. </p>
  
  <p>just as an example I have a teacher class with 3 or 4 varibles</p>
  
  <pre><code>public class Teacher {
  
  
  
          public static String teacherNo;
          public static String firstName;
          public static String lastName;
          public static Courses coursestought; 
  </code></pre>
  
  <p>and a class Courses</p>
  
  <pre><code>public class Course {
  
  
  
          public static String cCode;
          public static String cName;
  </code></pre>
  
  <p>the constructor for the teacher class is like this</p>
  
  <pre><code>// constructor 
          public Teacher(String teacher_No,String first_Name,String last_Name, 
                  Course coursesTought,)
  </code></pre>
  
  <p>I have all the right getters and setters(I think) </p>
  
  <p>I read from the text file like this. </p>
  
  <pre><code>BufferedReader inFile = new BufferedReader (new FileReader 
             ("pathtofile/teachers.txt"));
  </code></pre>
  
  <p>And I create the Teacher objects like this</p>
  
  <pre><code>String inputLine;
          inputLine = inFile.readLine();
          while (inputLine != null)
          {
  
              teacherlist.add(new Teacher
                      (inputLine, inputLine, inputLine, inputLine,));
              inputLine = inFile.readLine();
          }
  </code></pre>
  
  <p>But this only works if all the fields are strings not a mix of strings and variables and objects.  The fields in the text file are 1 line to a teacher and separated by : </p>
  
  <p>Can someone point me in the right direction here? </p>
  
  <p>Do I need to cut up the strings as I read them in ?</p>