java Program to illustrate the use of abstract keyword.

in this tutorial we are learn about abstract keyword mane .
mane use of abstract keyword is achieve abstract class.for classes abstract keyword is non access modifier in java, method but not variable . abstract is a one of the pillar of object oriented program(OOP).
important rule in abstract class:
any class that having one or more then one abstract method it is also declare abstract method.
the following are various illegal combination of other modifier for methods with respect to abstract modifier.
  1. final
  2. abstract native
  3. abstract synchronize 
  4. abstract static
  5. abstract private 
  6. abstract strictfp
  Code :

 

abstract class Vehicle

 

{

abstract void bike();

 

}

 

class Honda extends Vehicle

 

{

void bike() {

 

System.out.println("Bike is running");

 

}

 

}

 

public class abex {

Honda obj=new Honda();

 

obj.bike();

 

}

 

}

 

Output :-

abstract keyword.

Post a Comment

0 Comments