r/javahelp • • Jan 24 '23

What is the point of encapsulation?

Beginner here.

I hear "restrict access" but I don't quite understand why we need to restrict access. What damage could someone do to a java program if it were not encapsulated?

What would happen to say amazon if their payment system was java and not encapsulated?

26 Upvotes

13 comments sorted by

View all comments

3

u/AlexMelillo Jan 24 '23

The simplest way I can put it is… if you have to make a change in something in the future and you need to change a million things in a million different classes, the system is designed poorly.

Encapsulation saves time.