title: Insert resultSet into ArrayList
body: <p>I've spend all day looking for this and as far as I checked I always stick with an empty ArrayList. I also tried to display just the first record I find and I got null. What should be inserted into ArrayList are only courses, so Strings.</p>
  
  <pre><code>public String getProfessorCourses(){
         ................       
         //get the id related of the name
     String s = null;
     String sqlQuery = "SELECT courses.title FROM courses INNER JOIN professors_courses ON professors_courses.course_id = course.course_id WHERE prof_id = '"+1+"'";
  
         ArrayList&lt;String&gt; result = new ArrayList&lt;String&gt;();
  
         try {
           rst = stmt.executeQuery(sqlQuery);
          } catch (SQLException e1) {
              e1.printStackTrace();
          }
  
         try {
             //titles are not inserted
              while(rst.next()){
                //s = new String(rst.getString(1));
                //s = rst.getString(1);
                            s = new String(rst.getString("title"));    
                  }
          } catch (SQLException e) {
              e.printStackTrace();
          }
         .........................   
         return s;
        }
  </code></pre>