Hello All,
Today, we will discuss the remaining 2 parts of OOPS concepts which is Abstraction and Encapsulation.
What is Abstraction?
Hiding internal details of something and when we show only the functionality without considering the internal details of a system, is known as Abstraction.
Example: Can you think of something like this? I give you a minute to think over...THINK.
But, if you still do not get any answer, I tell you.
Example of your Mobile Phone or Car or Laptop. You just know how to use it, right but we do not know the internal structure of these.
In Java, we use abstract class and interface to achieve abstraction.
What is Encapsulation?
When we bind data and code together in a single unit, it is called encapsulation.
A very easy example to understand encapsulation is Java class. Your data members are private and you write the code for the functions you use.
You can give the above examples at the time of interview.
Please feel free to give your inputs in the comments section below. I hope, it will help you in understanding Java concepts.
0 comments:
Post a Comment