title: Creating an object of a different class from a reference of a Different Class
body: <p>I am a newbie in Java.... It was all going smooth till I found that below scenario is possible in JAVA.</p>
  
  <pre><code>package newProject;
  
  class A {
  }
  class B extends A {
      }
  
  public class C {
  
      public static void main (String[] args) {
        A obj = new B();
      }
  }
  </code></pre>
  
  <p>Can any one please explain me in detail about above scenario in terms of how is it possible and how it works on memory side</p>