title: How am I able to call a method on a null object?
body: <pre><code>public class JavaPuzzler {
  
      public static void main(String[] args) {
      JavaPuzzler javaPuzzler = null;
      System.out.println(javaPuzzler.get());
      }
  
      private static String get(){
          return "i am a java puzzler";
      }
  }
  </code></pre>
  
  <p>You might think that it should throw NullPointerException because the main method invokes get() method  on <strong>local variable which is initialized 
  to null</strong>, and you can’t invoke a method on null.</p>
  
  <p><strong>But if you run this program, you will see that it prints “i am a java puzzler”.</strong></p>
  
  <p>Can anybody give me the answer.
  Thanks in advance.</p>