0 votes
in JAVA by
What is the abstract class?

1 Answer

0 votes
by

A class that is declared as abstract is known as an abstract class. It needs to be extended and its method implemented. It cannot be instantiated. It can have abstract methods, non-abstract methods, constructors, and static methods. It can also have the final methods which will force the subclass not to change the body of the method. Consider the following example.

abstract class Bike{  

  abstract void run();  

}  

class Honda4 extends Bike{  

void run(){System.out.println("running safely");}  

public static void main(String args[]){  

 Bike obj = new Honda4();  

 obj.run();  

}  

}  

Related questions

+1 vote
asked May 12, 2021 in JAVA by rajeshsharma
+1 vote
asked May 5, 2021 in JAVA by SakshiSharma
...