How to achieve abstraction?

 Q. How to achieve abstraction ?

Ans :- we can achieve abstraction by using abstract classes and Interfaces.

Abstraction in java can be achieved in two ways:

  1. Using abstract classes:- Abstract classes achieve partial abstraction as concrete methods can also be defined in them.


  1. Using Interfaces :- Interfaces achieve complete abstraction as only abstract methods can be defined in them.

Comments