A field, method or property marked as ________ can be accessed by the defining class and any child classes.A ) privateB ) hiddenC ) protectedD ) internalE ) public
Question
A field, method or property marked as ________ can be accessed by the defining class and any child classes.A ) privateB ) hiddenC ) protectedD ) internalE ) public
Solution
The correct answer is C) protected. A field, method or property marked as protected can be accessed by the defining class and any child classes.
Similar Questions
Assume we have a parent class and a child class.class Parent { private String id; protected String name; }In the child class, the private members(instance attributes / methods) blank andthe protected members blank .can be accessed using public method ‑ getters can be accessed directly using the attribute name cannot be accessed at all
If a field is private, which methods have access to it?A ) Only static methods in the same class.B ) None of these answers are correctC ) Only instance methods in the same class.D ) Only classes in the same packageE ) Only those defined in the same class.
The access specifier which allows one to access data by other classes but not from outside objects?Options: Pick one correct answer from belowPrivateProtectedPublicBoth protected and public
Which access specifier is usually used for data members of a class?a) Protectedb) Privatec) Publicd) Default
A superclass' members are accessible anywhere that the program has a reference to an object of that superclass or to an object of one of its subclasses if the members have what access modifier?a.publicb.privatec.protected
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.