ArrayList being returned but recieving a null pointer?
<p>Assuming I have two methods. One that creates an arraylist and returns it, the other retrieving that list to process. both methods are in different classes:</p>

<pre><code>public ArrayList getSocialUsers() throws SQLException
{
    Connection conn=DriverManager.getConnection("jdbc:mysql:///socialsystemtest1?user=root&amp;password=");
    Statement stmt= null;
    String query="SELECT FORE_NAME FROM socialsystemtest1.socialworkers";
    stmt= conn.createStatement();
    ArrayList&lt;String&gt; socialWorkers= new ArrayList&lt;String&gt;();
    try{
        ResultSet rs= stmt.executeQuery(query);
        while(rs.next())
        {
            String user= rs.getString("Fore_Name");
            socialWorkers.add(user);
        }
    }
    catch(SQLException e) {
        //do nothing
    }
    finally{
        if(stmt != null) {
            stmt.close();
        }
    }

    return socialWorkers;

}

public void processArray(){
  try{
    ArrayList&lt;String&gt;= db.getSocialUsers();
    //code ommitted
  }
  catch(SQLException e){
    //deal with it here
  }
}
</code></pre>

<p>db is an instance of the class that returns the arraylist already instantiated. I recieve a null pointer error at the first line of the second classes method: <code>db.getSocialUsers();</code></p>

<p>when calling the <code>getSocialUsers()</code> method on its own this works and an <code>ArrayList</code> is indeed returned with the correct elements but when calling it from another class gives a null pointer and I don't know why </p>
