+ 4

What does it mean when you declare a variable like int as"protected"?

does it mean the same as private...

4th Nov 2016, 4:02 AM
Kaleb Cole-Wood
Kaleb Cole-Wood - avatar
5 Answers
+ 2
thanks!
4th Jan 2017, 2:58 PM
Kaleb Cole-Wood
Kaleb Cole-Wood - avatar
+ 1
protected means only inheritance class of mother class and mother class itself can access and modified it.
4th Nov 2016, 4:26 AM
Aditya kumar pandey
Aditya kumar pandey - avatar
+ 1
Variables, methods, and constructors, which are declared protected can be accessed only by the subclasses in other package or any class within the package of the protected members' class.
4th Jan 2017, 2:41 PM
Niloy Rashid
Niloy Rashid - avatar
0
Protected means visible from subclasses and from classes of the same package.
4th Nov 2016, 5:56 AM
Simone Trombiero
0
Absolutelly not. Private means visible only from the class itself, not from subclasses or package classes.
4th Nov 2016, 6:52 AM
Simone Trombiero