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
πŸ’¬ Discuss
βœ… Correct Answer: (D) Yes, regardless of the package
Explanation: In Java, protected members (fields and methods) of a superclass are accessible to its subclasses.
Explanation by: Ravi Shankar
In Java, protected members (fields and methods) of a superclass are accessible to its subclasses.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
124
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Ravi Shankar
Publisher
πŸ“ˆ
93%
Success Rate