2. Contents:
Abstract Class
Abstract Class Program
Concrete Class
Concrete Class Program
Relation between Abstract Class and Concrete Class
Program output
3. Abstract Class
Abstract class is just like other classes but it marks with abstract
keyword.
Classes that contain one or more abstract methods
An abstract method is that which is declared but contains no
implementation.
A method can be made abstract if we add the keyword “abstract”
to it
Abstract classes may not be instantiated, and require subclasses to
provide implementations for the abstract methods
These subclasses are also known as child class or derived class.
Now here is a simple program of an Abstract class
5. Why we use abstract class?
The purpose of an abstract class is to provide a common
definition of a base class that multiple derived classes can
share.
For example; we were modeling the behavior of animals.
Animals are capable of doing different things. Some
common operations are performed by all animals, but in a
different way as well as like the sounds they make.
And we can simply do this by overriding.
6. Concrete Class
Default class in java
A derived class that provides the basic implementations for all of
the methods that are not already implemented in the base class.
The concrete class is the implementation of an abstract class
methods.
We can also call concrete methods of abstract class in concrete
class objects.
8. Why we use Concrete Class?
The implementation of an Abstract class.
In concrete class (child or derived class) you can
call the methods of abstract class by overriding the
methods of abstract class and then in main method
we call the objects of concrete class which gives us
the implementation of abstract class.