title: How to add an object into another Object set
body: <p>I have two classes. One(Person) for getters and setters, and another(People) for compute the data. What is my situation is, I get the data from the DB using <code>ResultSet</code>, then created  a person Object to store the row data. Then i created people Object to store all persons.</p>
  
  <p>Each Object created as SET. </p>
  
  <pre><code>while(rs.next())
  {
      Set&lt;People&gt; people = new HashSet&lt;people&gt;();
      Person person = new Person();
      String name = rs.getString(2);
      person.setName(name);
      int id = rs.getInt(1);
      person.setId(id);
      String dept = rs.getString(4);
      person.setDept(dept);
      int age = rs.getInt(3);
      person.setAge(age);
      people.add(person);
  }
  return people;
  </code></pre>
  
  <p>Now the problem is the last line in the While Loop <code>people.add(person);</code></p>
  
  <p>It says</p>
  
  <blockquote>
    <p>The method add(People) in the type Set is not applicable for the arguments (Person)</p>
  </blockquote>
  
  <p>How can i overcome this problem?</p>
  
  <p>Thanks.</p>