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.
  2. Using Interfaces :- Interfaces achieve complete abstraction as only abstract methods can be defined in them.

Leave a Reply

Your email address will not be published. Required fields are marked *

*