title: Using "this" with methods (in Java)
body: <p>what about using "this" with methods in Java? Is it optional or there are situations when one needs to use it obligatory?</p>
  
  <p>The only situation I have encountered is when in the class you invoke a method within a method. But it is optional. Here is a silly example just to show what I mean:</p>
  
  <pre><code>public class Test {
  
      String s;
  
      private String hey() {
          return s;
      }
  
      public String getS(){
          String sm = this.hey();
          // here I could just write hey(); without this
          return sm;
      }
  }
  </code></pre>