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

Popular posts from this blog

How to create React project using command prompt?

Interview Question? How to find square of each element in this Array {2,4,5,6,8} using map ?