Question: Question: In Java, what is the result of attempting to access an instance variable of a superclass from a subclass if that variable is marked
Question: In Java, what is the result of attempting to access an instance variable of a superclass from a subclass if that variable is marked as protected?
A) The instance variable is not accessible from any subclass.
B) The instance variable is accessible only within the superclass.
C) The instance variable is accessible from the subclass and other classes in the same package.
D) The instance variable can only be accessed through getter methods.
Step by Step Solution
There are 3 Steps involved in it
The detailed answer for the above question is provided below The correct option is C The instance variable is accessible from the subclass and other c... View full answer
Get step-by-step solutions from verified subject matter experts
