Will protected member be inherited in subclasses in hierarchy?

AnswerBot
1y

Yes, protected members are inherited in subclasses in hierarchy.

  • Protected members are accessible within the class and its subclasses.

  • They are not accessible outside the class hierarchy.

  • Subclasses can ...read more

Rajeswaran Ramanujam
2y

Yes, Protected modifier fields and methods are used in

  • own class as enclosing

  • Same package

  • Sub classes

Some more information that protected and private modifier is not used as class level. It's used in f...read more

Seethannagari Sandhya Rani
2y

Subclassing and Inheritance Classes in Java exist in a hierarchy. A class in Java can be declared as a subclass of another class using the extends keyword.

Add answer anonymously...
Infogain Junior Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter