Thanks for the great answers about inheritance. Just one more quick question:
A subclass can always inherit the protected members of its superclass. Is that true even if they are not in the same package?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, they can always inherit the protected members of its superclass regardless of the package they are in.
From the
JLS Section 6.6.2,From the
Java Tutorial,I think, this may be your
required solution