What is abstract Class
An abstract class is nothing but a collection of concrete or non-concrete methods; a concrete method contains a body (implementation) and non-concrete methods do not contain a body; its just a prototype declaration like access modifier, return type, parameter etc.
What Situation when abstract class have Importance
Syntax of declaration abstract class "abstract" is a keyword in java; with the help of the abstract keyword we can make abstract classes and methods.For making an abstract class:
abstract class abhishek { /* body of class*/ note in this class one abstract method }For making an abstract method:abstract int abstractmethod (list of parameter); /* we can not give the body of An example of an abstract class: abstract class Abhishek { abstract void abstractmethod(); // concrete methods are still allowed in abstract classes void nonabstract() { System.out.println("This is a concrete method."); } } class Child extends Abhishek { void abstractmethod() { System.out.println("B must be implementation of abstractmethod."); } }class AbstractDemo { public static void main(String args[]) { Child b = new Child(); b.abstractmethod(); b.nonabstract(); } }
Ouput
Summary
You can create yourown abstract class and method with the help of this example. There are not any limitations for making an abstract method and non-abstract method in your program but all the abstract methods are overriden by a child class (inherited class).
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: