Can we define a class as protected in Java?
I'll answer
Earn 20 gold coins for an accepted answer.20
Earn 20 gold coins for an accepted answer.
40more
40more
Works at the International Development Association, Lives in Washington, D.C., USA.
Since there's no such concept as 'subpackage' or 'package-inheritance' in Java, declaring class protected or package-private would be the same thing. You can declare nested and inner classes as protected or private, though.
2023-05-11 14:10:00
评论(499)
Helpful(122)
Helpful
Helpful(2)

Riley White
QuesHub.com delivers expert answers and knowledge to you.
Since there's no such concept as 'subpackage' or 'package-inheritance' in Java, declaring class protected or package-private would be the same thing. You can declare nested and inner classes as protected or private, though.