Can a class be private or 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 World Health Organization, Lives in Geneva, Switzerland.
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-07 14:09:55
评论(499)
Helpful(122)
Helpful
Helpful(2)

Julian Mitchell
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.