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

What are POJO classes in spring? What is the use of POJO Class, and How to create POJO classes.

How to create React project using command prompt?