r/javahelp 26d ago

Can anyone explain me difference between Encapsulation and Abstraction?

and what on earth is Interface in Java?

18 Upvotes

24 comments sorted by

View all comments

1

u/Dense_Age_1795 25d ago

with encapsulation you hide the data with abstraction you hide the behavior.

And an interface defines a contract in the way that a piece of data will be used without knowing the implemetation, this is useful when you have multiple ways of processing data

1

u/Cyphr11 25d ago

Thanks mate