hi i think you have heard about polymorphysm.
A a = new B(); this is polymorphysm the advantage of this is non static methods when overriding goes to the object type.
class A{
int x = 10;
void m(){
System.out.println("Mike");
}
}
class B extends A{
int x = 20;
void m(){
System.out.println("You");
}
}
class C{
public static void main(
String ar[]){
A a = new B();
a.m();
System.out.println(a.x);
}
}
now here the out put will be You
but in second out put will be 10 other than non static methods all the others goes to the Referance type.