title: What does MySingleTon st = MySingleTon.getInstance(); mean in this code?
body: <p>Today I was reading a sample java program to create a singleton class. The code is as follows:</p>
  
  <pre><code>public class MySingleTon {
  
  private static MySingleTon myObj;
  /**
   * Create private constructor
   */
  private MySingleTon(){
  
  }
  /**
   * Create a static method to get instance.
   */
  public static MySingleTon getInstance(){
      if(myObj == null){
          myObj = new MySingleTon();
      }
      return myObj;
  }
  
  public void getSomeThing(){
      // do something here
      System.out.println("I am here....");
  }
  
  public static void main(String a[]){
      MySingleTon st = MySingleTon.getInstance();
      st.getSomeThing();
  }
  }
  </code></pre>
  
  <p>I don't understand what the piece of code <code>MySingleTon st = MySingleTon.getInstance();</code> means? 
  I mean we are creating an object <code>st</code> by <code>MySingleTon st</code>; so it should have been written as <code>new MySingleton</code>. So what is <code>MySingleTon.getInstance();</code> doing actually?</p>