creating object with different reference
<p>I am so confused in this topic. 
//a class (lets say B) extendes or implements another class or interface respectively</p>

<pre><code>interface myInterfaceA{

int interfaceDataMember1;
int interfaceDataMember2;

void interfaceMethod1();
void interfaceMethod2();

}

class myClassA{

int parentClassDataMember1;
int parentClassDataMember2;

myclassA(){}

void parentClassMethod1(){}
void parentClassMethod2(){}

}
</code></pre>

<p>//case1 </p>

<pre><code>class B implements myInterfaceA{

int dataMember1;
int dataMember2;

B(){}

void method1(){}
void method2(){}
}
</code></pre>

<p>//    OR case2</p>

<pre><code>class B extends myClassA{

int dataMember1;
int dataMember2;

B(){}

void method1(){}
void method2(){}
}
</code></pre>

<p>// so in either case what is the purpose of creating the object of class B in the following way</p>

<pre><code>myInterfaceA objectB = new B();
// or 
myClassA objectB = new B();
</code></pre>

<p>1) is there any name of this procedure?
2) what (data memeber, methods, constructor ) will be loaded in objectB?
3) if all the code of class B will be loaded in the objectB then why did we give the refrece of interface or parent class?
4) is this shows polymorphism? if yes, then why?
5) in case2 will class B also inherit the constructor of myClassA
6) why the constructor of parentclass is also called whe we create child class object </p>