0

What are the differences between public, private, and protected?

I am in my java class and my teacher doesn't really like to use the protected method I was wondering if is really not that useful.

13th Jan 2017, 5:18 PM
Richard Harding Jr
1 Odpowiedź
0
protected gives access to the methods and variables of a class inside the same package and to the class's derived classes. public gives access from everywhere and private only allows access from inside the class.
13th Jan 2017, 5:26 PM
Andreas K
Andreas K - avatar