Whats the point of limiting accessibility using Private and Protected? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Whats the point of limiting accessibility using Private and Protected?

Is this to prevent hackers or something? I understand how it works but not why its used.

13th Mar 2019, 9:18 PM
Calvis Huynh
Calvis Huynh - avatar
4 Answers
0
So from my understanding when you work with someone, but have different assignments, your code can be messed up by that person, without them touching your class directly?
13th Mar 2019, 10:44 PM
Calvis Huynh
Calvis Huynh - avatar
+ 1
Hiding Data from who? Only you have access to your code right
13th Mar 2019, 9:25 PM
Calvis Huynh
Calvis Huynh - avatar
+ 1
Yes.Java has some principles called OOP(object oriented programming).one of the OOP concepts is Encapsulation (hiding code from misuse or limiting scope of a piece of code).
13th Mar 2019, 10:48 PM
Home Number
Home Number - avatar