Prashil Wasnik ,this is an example of "is an" relation, which means object of subclass is also an object of super class. This concept is the root for polymorphic behaviour of super class, which used for overriding of nonstatic methods.
class ParentClass
{
int method1()//1
{
// implementation
}
}
class ChildClass extends ParentClass
{
int method1()//2
{
}
public static void main(
String arg[])
{
ParentClass a=new ParentClass();
a.method1();//calls 1
ParentClass a=new ChildClass();
a.method1();//calls 2
}
}
Hope it is clear.