Program:-
class phone{
public void showTime(){
System.out.println("Time is 8 am");
}
public void on(){
System.out.println("Starting the phone...");
}
}
class Smartphone extends phone{
public void music(){
System.out.println("Playing music...");
}
public void on(){
System.out.println("Starting the smartphone...");
}
}
public class DynamicMethodDispatchV48 {
public static void main(String[] args) {
phone obj = new Smartphone();//Yes it is Allowed.
//Smartphone obj2 = new phone(); // it is not Allowed.
obj.showTime();
obj.on();//print the "starting the smartphone" not "starting the phone".
//obj.music(); not Allowed.
}
}

