title: Java How create a set of object with two classes?
body: <p>I have a logical problem to understand, how create a private set of inhabitant object. Here my two classes:</p>
  
  <pre><code>package main;
  import java.util.Set;
  
  
  /**
   * @author 
   * @version 0.1
   *
   */
  public class City {
  
      private String name;
      /**
      *HERE is my Problem*/   
      private Set&lt;Inhabitants&gt; Inhabitants {
  
      } 
  
      /**
       * standard cunstructor
       */
      public City(String n, ) {
          setName(n);
      }
  
      /**
       * Search a particular name of inhabitant
       * @return object of inhabitant
       */
      static Set&lt;Inhabitants&gt; Search(){
          return inhabitants;
  
      }
  
      /**
       * Creates a inhabitant object and 
       * add to the set of inhabitants of the city
       * 
       * @param name
       * @param datebirth
       * @param maritalStatus
       * @
       */
      public void Add(String name,String datebirth,String maritalStatus) {
  
      }
      /**
       * Return all inhabitants objects of the city
       * @return 
       */
      static Set&lt;Inhabitants&gt; ReturnAll(){
          return inhabitants; 
      }
  
      /**
       * Return city name
       * @return 
       */
      static Set&lt;Inhabitants&gt; ReturnCityName(){
          return inhabitants;
      }
  
  
      /**
       * @return the name
       */
      public String getName() {
      return name;
      }
  
      /**
       * @param name the name to set
       */
      public void setName(String name) {
          this.name = name;
      }
  
      /**
       * @return the inhabitants
       */
      public Set&lt;Inhabitants&gt; getInhabitants() {
          return inhabitants;
      }
  
      /**
       * @param inhabitants the inhabitants to set
       */
      public void setInhabitants(Set&lt;Inhabitants&gt; inhabitants) {
          this.inhabitants = inhabitants;
      }
  }
  
  package main;
  
  /**
   * @version 0.1
   */
  public class Inhabitants {
  
      private String name;
      private String datebirth;
      private Boolean maritalStatus;
  
      /**
       * standard constructor
       */
      public Inhabitants() {
      }
  
      /**
       * @return the name
       */
      public String getName() {
          return name;
      }
  
      /**
       * @param name the name to set
       */
      public void setName(String name) {
          this.name = name;
      }
  
      /**
       * @return the datebirth
       */
      public String getDatebirth() {
          return datebirth;
      }
  
      /**
       * @param datebirth the datebirth to set
       */
      public void setDatebirth(String datebirth) {
          this.datebirth = datebirth;
      }
  
      /**
       * @return the maritalStatus
       */
      public Boolean getMaritalStatus() {
          return maritalStatus;
      }
  
      /**
       * @param maritalStatus the maritalStatus to set
       */
      public void setMaritalStatus(Boolean maritalStatus) {
          this.maritalStatus = maritalStatus;
      }
  }
  </code></pre>