Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- abstract class Bike{
- Bike(){System.out.println("bike is created");
- }
- abstract void run();
- void changeGear(){System.out.println("gear is changed");}
- }
- class Honda extends Bike{
- void run(){System.out.println("running safely");}
- }
- class TestAbstraction2{
- public static void main(String args[]){
- Bike obj=new Honda();
- obj.run();
- obj.changeGear();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement