JAVA program that implements Runtime polymorphism

 JAVA program that implements Runtime polymorphism 



Source Code :
 
/* Write a JAVA program that implements Runtime polymorphism  */
class Bike
{  
  void run() {
System.out.println("running");
   }  
}  
class Splender extends Bike
{  
  void run() {
          System.out.println("running safely with 60km");
   }  
    public static void main(String args[]) {  
    Bike b = new Splender();//upcasting  
    b.run();  
  }  
}  





Post a Comment

0 Comments

Close Menu