Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (6.1k points)

What I know about encapsulation is that it is the interaction between a user and a mobile phone.

There is no need for the user to know the internal working of the mobile phone to operate, so this is called abstraction. But then how encapsulation makes its place here in this example?

1 Answer

0 votes
by (11.7k points)

With Encapsulation, we can achieve information hiding. For example, you don't "need to know the internal working of the mobile phone to operate" with it. You have an interface to use the device behavior without knowing implementation details.

Abstraction, on the other hand, is the capability to use the same interface for different objects. There can be a case where different implementations of the same interface can exist. Details are hidden by encapsulation.

If you want to become an expert in Java, check out this Java course from Intellipaat.

Related questions

0 votes
1 answer
asked Mar 11, 2020 in Java by Sudhir_1997 (55.6k points)
0 votes
1 answer
asked Mar 11, 2020 in Java by Sudhir_1997 (55.6k points)
0 votes
1 answer
asked Feb 15, 2021 in Java by sheela_singh (9.5k points)
0 votes
1 answer
asked Dec 23, 2020 in Python by ashely (50.2k points)

Browse Categories

...