title: java - return object value
body: <p>Hi i have the following code:</p>
  
  <pre><code>public List&lt;Person&gt; findAll() {
  
      List&lt;Person&gt; copy = new ArrayList&lt;Person&gt;();
      for (Person person : personer) {
          copy.add(person);
      }
  
      return copy;
  
  }
  </code></pre>
  
  <p>But when i test this i only retrieve the following and not the value:</p>
  
  <blockquote>
    <p>[Person@15c7850, Person@1ded0fd,
    Person@16a9d42]</p>
  </blockquote>
  
  <p>How do i get the values and not like above. Where i am inserting the person the code looks like this:</p>
  
  <pre><code>public boolean insert(String name, String nbr) {
  
      if (containsName(name)) {
                      return false;
              }
      Person person = new Person(name, nbr);
      personer.add(person);
  
              return true;
  }
  </code></pre>
  
  <p>and here is my Person class:</p>
  
  <pre><code>class Person {
  
  private String name;
  private String nbr;
  
  
  
  
  
  public Person (String name, String nbr) {
      this.name = name;
      this.nbr = nbr;
  }
  
  
  public String getName() {
      return name;
  }
  
  
  public String getNumber() {
      return nbr;
  }
  }
  </code></pre>