Thursday, 12 February 2015

Method Overriding

  1. class Vehicle{  
  2. void run(){System.out.println("Vehicle is running");}  
  3. }  
  4. class Bike2 extends Vehicle{  
  5. void run(){System.out.println("Bike is running safely");}  
  6.   
  7. public static void main(String args[]){  
  8. Bike2 obj = new Bike2();  
  9. obj.run();  

No comments:

Post a Comment