R

Ravi Shankar • 4.19K Points
Extraordinary

Q. In Java, can a subclass access protected members (fields and methods) of its superclass?

  • (A) Only if the subclass is marked as "final"
  • (B) No, protected members are not accessible to subclasses
  • (C) Yes, as long as it's in the same package
  • (D) Yes, regardless of the package
  • Correct Answer - Option(D)
  • Views: 16
  • Filed under category JAVA

Explanation by: Ravi Shankar
In Java, protected members (fields and methods) of a superclass are accessible to its subclasses.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.


Question analytics