Examveda
Examveda

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

Answer: Option C


This Question Belongs to Java Program >> Inheritence

Join The Discussion

Comments ( 1 )

  1. Kareem Abdullah
    Kareem Abdullah :
    4 months ago

    why? subclass can access protected members of its superclass even in a different package

Related Questions on Inheritence

What is inheritance in Java?

A. The process of acquiring properties and behaviors of one class by another

B. The process of creating objects

C. The process of encapsulation

D. The process of overloading methods