- A class that is declared with abstract keyword, is known as abstract class in java. It can have abstract and non-abstract methods (method with body).
- A method that is declared as abstract and does not have implementation is known as abstract method.
abstract class A
{
}
Example:-
abstract class Bike //Abstract Class
{
abstract void run(); //Abstract Method
}
class Honda4 extends Bike
{
void run()
{
System.out.println(“running safely..”);
}
public static void main(String args[])
{
Bike obj = new Honda4();
obj.run();
}
}
0 Comments:
Post a Comment