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
Question
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
Solution 1
In the child class, the private members cannot be accessed at all and the protected members can be accessed directly using the attribute name.
Solution 2
In the child class, the private members cannot be accessed at all and the protected members can be accessed directly using the attribute name.
Solution 3
In the child class, the private members cannot be accessed at all and the protected members can be accessed directly using the attribute name.
Similar Questions
A field, method or property marked as ________ can be accessed by the defining class and any child classes.A ) privateB ) hiddenC ) protectedD ) internalE ) public
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
Which of the following is false about protected class members?They begin with one underscoreThey can be accessed by subclassesThey can be accessed by name mangling methodThey can be accessed within a class
Which access modifier allows member access only within the same class and its subclasses?a.publicb.protectedc.defaultd.private
In Java, a subclass can directly access the private members of its superclass.Select one:TrueFalse
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.