Hi Rathi Ji,
Thanks for spending your most valuable time fo giving response.
I tried the following example:
class Base {
public void
test(){
System.out.println("Super class test()");
}
}
class Sub extends Base {
public void test(){
System.out.println("test() is overriding method");
}
public static void main(
String[] args){
Base ob = new Sub();
ob.test();
}
}
//output is: test() is overriding method
But my doubt is: deciding which method to be called during compile time is compile time polymorphism.
ex: Sub ob = new Sub(); //This is example for compile time polymorphism.
Deciding which method to be called at runtime is runtime polymorphism.
Super ob = new Sub();//Example for runtime polymorphism.
Thanks for spending your most valuable time for giving response.