Friday, March 29, 2019

Abstraction in Java

If you recently started learning Java, then I believe you must have somewhere come across a term called object-oriented programming or OOP. Now, there are four pillars in OOPs — abstraction, polymorphism, encapsulation, and inheritance. In this article, we will discuss one of the four pillars of OOP — abstraction.

Basically, abstraction is the art of hiding implementation details from the user and provide the user with what they want. Let’s try to understand that further with a real-world example. Most of us are quite fond of owning a car. When we go to place an order for the car, we are really not interested in understanding the fine details of the implementation of each and every component inside the car engine, glove box, etc. We leave those technical details and implementation for manufacturing engineers and mechanics to understand — we are simply interested in the car, not the manufacturing company. They are interested in providing us with what we want and hiding the finer implementation details. Likewise, there are tons of real-world examples where abstraction is at play — whether in the smartphone you are using or a smart television — all have implemented abstraction in one way or another.



from DZone.com Feed https://ift.tt/2uySMbX

No comments:

Post a Comment