What is Abstraction:
Abstraction means hiding implementation details and showing only essential features to the user.
Why Do We Need Abstraction?
- To improve security
- To hide unnecessary implementation
- To improve maintainability
How Abstraction is Achieved in Java?
It can be achieved using Abstract classes
If a class contains at least one abstract method, then the class should be declared with the abstract keyword.
It may have an abstract method, a non-abstract method, a constructor, and a variable
Static methods are allowed
What can't be applied:
-Can't create an object for an abstract class
-Can't initialize instance value because object creation is restricted.
-Abstract Method Cannot Be Private, Because abstract methods must be overridden in a child class.
-Abstract Method Cannot Be Final
Top comments (0)