📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!


    Question

    Which of the following members of a superclass are NOT

    inherited by its subclass?
    A public methods Correct Answer Incorrect Answer
    B protected fields Correct Answer Incorrect Answer
    C private members Correct Answer Incorrect Answer
    D default (package-private) members (if in the same package) Correct Answer Incorrect Answer
    E static methods Correct Answer Incorrect Answer

    Solution

    private members of a superclass are not directly inherited by subclasses. They are part of the superclass's internal implementation and are only accessible within the superclass itself. Subclasses can only access them indirectly through public or protected methods of the superclass.

    Practice Next
    ask-question