object ref in Java programming
<p>I want to know about the advantage in between the creating an object for sub class but assigning class A ref instead of assigning Class B ref. which is shown in line1,line2 below code </p>

<pre><code> class A
    {
         int b=10;
     }
    class B extends A
    { 
         int b=12;

        }
    class Test
    {
         public static void main(String[] args)
         {
               A a=new B(); //line1 
               //B a=new B();//line2
            System.our.println(a.b);
         }
    }
</code></pre>
