title: Im trying to Write a Team class encapsulating the concept of a Team but I can't seem to compare the two teams
body: <p>Heres what I have so far including the test class I'm just not sure how to compare the two teams this is the assignment................ The team has only one attribute, the team name (example Barcelona)</p>
  
  <p>Include the following:</p>
  
  <ul>
  <li><p>Constructor</p></li>
  <li><p>getter/assessor method</p></li>
  <li><p>mutator/setter method</p></li>
  <li><p>toString method</p></li>
  <li><p>equals method</p></li>
  </ul>
  
  <p><strong>Class Team</strong></p>
  
  <pre><code>public class Team {
  
  private String name;
  
  public Team(String name) { // Constructor
  
      this.name = name;
  }
  
  public void setName(String name) { // The Setter set's the name
  
      this.name = name;
  }
  
  public String getName() { // The Getter get's the the name
  
      return name;
  }
  
  @Override
  public String toString() { // This returns a String object
  
      return "The team name is " + name;
  }
  
  @Override
  public boolean equals(Object o) {
  
      if (o instanceof Team) {
  
          Team t = (Team) o;
  
          if (t.getName().equalsIgnoreCase(getName())) { //I'm not sure what i'm missing here
  
              return true;
          }
  
          else {
              return false;
  
          }
  
      }
  
      else {
  
          return false;
      }
  }
  
  }
  </code></pre>
  
  <p><strong>Test class</strong></p>
  
  <pre><code>public class TeamMain {
  public static void main(String[] args) {
  
      Team team = new Team("ManUnited");
  
      Team team2 = new Team("ManCity");
      System.out.println(team.equals("ManUnited"));
  
      System.out.println(team2.equals("ManCity"));
  
      System.out.println(team.getName());
      team.setName("ManCity");
      System.out.println(team.toString());
  }
  
  }
  </code></pre>