title: Comparing Strings using java
body: <p>I have to create an equals method that return true if the Politicians' titles are the same. How do I compare the strings?</p>
  
  <p>This is how I've tried to write it so far:</p>
  
  <pre><code>public class Politician implements Priority{
  private String name, title;
  private int a;
  public Politician(String n, String t, int p){
      name=n;
      title=t;
      a=p;
  }
  public boolean equals(Politician a){
      if(title.equals(a.title))
          return true;
      return false;
  }
  </code></pre>
  
  <p>However, it just always return false. Even when I test:</p>
  
  <pre><code>Priority t4= new Politician("Arnie", "Governor", 4);
      Politician t5= new Politician("Bill", "Governor", 10);
      System.out.println(t5.equals(t4)); 
      System.out.println(t4.equals(t5));
  </code></pre>
  
  <p>I've written equals() before and I don't know why it's not working anymore</p>