Abstraction is the process of showing what is essential to the user and hiding all non-essential details. In java, we can implement the abstraction using Abstract classes and Interfaces.
In java, the abstract keyword used to declare abstract classes & methods.
Abstract Class:
- An abstract class declared with keyword abstract.
- An abstract class can have both abstract and non-abstract methods.
- Abstract classes restricted to create objects. So, we cannot instantiate.
- If a class has one or more abstract methods must be declared as an abstract class.
- Any class that extends the abstract class should implement all the methods.
- An abstract class can have static & final methods and constructors.
0 Comments