+ 1

What is the use of protected access specifier in Java.

5th Jul 2017, 2:49 AM
Viraj Singh
Viraj Singh - avatar
4 odpowiedzi
+ 6
Protected isn't used ask that often. It means that the value that it specifies can only be modified (or the function that it specifies can only be accessed) within the class or by any derived classes.
5th Jul 2017, 2:54 AM
Keto Z
Keto Z - avatar
+ 4
@Viarj parotected can only... public can also...
5th Jul 2017, 4:17 AM
seamiki
seamiki - avatar
+ 1
Same goes for public, data members and methods declared public can also be modified and accessed within the class or derived class so what's the diffrence?
5th Jul 2017, 3:46 AM
Viraj Singh
Viraj Singh - avatar