title: Creating compareTo method in java with one parameter
body: <p>I have a question about making a <code>compareTo</code> function in Java.</p>
  
  <p>In Java, we have the <code>String.compareTo(String)</code> method.</p>
  
  <p>However, I need to make a <code>compareTo</code> function with only only parameter, like: <code>compareTo(String)</code>.</p>
  
  <p>I assume that I need to use this to hold another string.</p>
  
  <p>For example:</p>
  
  <pre><code>public static boolean compareTo(String word)
  {
  
    private string this.word = word;
  
     if(word.equals(this.word))
     {
         return true;
  
      } 
     else
    {
      return false;
    }
  
  }
  </code></pre>
  
  <p>Is this the right idea?</p>
  
  <p>Do I need to create get and set functions to hold first word to compare with second word?</p>
  
  <p>Thanks</p>