Arnab_Manna

abstraction4.java

Nov 27th, 2021
743
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. abstract class Bike{
  2.     Bike(){System.out.println("bike is created");
  3.     }
  4.     abstract void run();
  5.     void changeGear(){System.out.println("gear is changed");}
  6. }
  7.  
  8. class Honda extends Bike{
  9.     void run(){System.out.println("running safely");}
  10. }
  11.  
  12. class TestAbstraction2{
  13.         public static void main(String args[]){
  14.             Bike obj=new Honda();
  15.             obj.run();
  16.             obj.changeGear();
  17.         }
  18. }
RAW Paste Data