title: Implementing the comparable interface
body: <p>I just found this exam question and cannot figure it out :</p>
  
  <p>The following depicts a contrived partial class which implements the Comparable interface. The only purpose of this contrived class is comparing its instances with a given string.</p>
  
  <p>There are two things we need to fill in in the class to finish it. Here is the class : </p>
  
  <pre><code>public class PrivateComparableClass // FILL IN PART 1 { 
     private String thing;
  
      public PrivateComparableClass(String thing) {
       this.thing=thing;
      }
     //FILL IN PART 2
  }
  </code></pre>
  
  <p>I am assuming part 1 simply corresponds to :</p>
  
  <pre><code>public class PrivateComparableClass implements Comparable {
  </code></pre>
  
  <p>And part 2, I assume he is expecting an implementation of the compareTo method, but I don't really know how to properly go about implementing this:</p>
  
  <pre><code>public static int compareTo() {
    if this.thing.equals(thing){
    return 1;
    } else {
      return -1;
    }
  }
  </code></pre>
  
  <p>How would I go about fixing this?</p>