+ 1

Wrong answer?

Is it correct answer? Select the access modifier to hide members from their package. - protected - none specified - public - private -> it is correct according to Java Challenge

3rd Nov 2019, 5:19 PM
Maciej Kowalik
Maciej Kowalik - avatar
5 Respuestas
+ 5
Yes it is correct I think because they are talking about package and it can contain many classes inside. So a public member of a class will always be visible to other classes similarly a protected member of a class will be visible to its subclass when inherited and only private is accessible within the class in that package.
3rd Nov 2019, 5:24 PM
Avinesh
Avinesh - avatar
+ 3
Well, when speaking of members of a class in Java: Protected = member can be accessed within its own package and by a subclass None specified = package-private, again accessible within package Public = accessible by all code Only PRIVATE prevents other classes within the same package from accessing members of the given class.
3rd Nov 2019, 5:34 PM
Michal Straka
Michal Straka - avatar
+ 1
Ok, I didnt understand questions, thanks for your answer, now is clear.
3rd Nov 2019, 5:26 PM
Maciej Kowalik
Maciej Kowalik - avatar
+ 1
In this app, in Java challenge.
3rd Nov 2019, 5:29 PM
Maciej Kowalik
Maciej Kowalik - avatar
0
Maciej Kowalik yes these are not so good framed questions. By the way where do you get these challenges?
3rd Nov 2019, 5:28 PM
Avinesh
Avinesh - avatar