QuesHub > > > > ASK DETAIL

Why class can not be private in Java?

Harper Gonzales | 2023-05-05 12:30:24 | page views:1728
I'll answer
Earn 20 gold coins for an accepted answer.20 Earn 20 gold coins for an accepted answer.
40more

Ethan Garcia

Works at Facebook, Lives in Menlo Park, CA
A top-level class as private would be completely useless because nothing would have access to it. ... This means that a top level class cannot be private. Private classes are allowed but only as inner or nested classes. If you have a private inner or nested class, then access is restricted to the scope of that outer class.
2023-05-12 12:30:24

Isabella Carter

QuesHub.com delivers expert answers and knowledge to you.
A top-level class as private would be completely useless because nothing would have access to it. ... This means that a top level class cannot be private. Private classes are allowed but only as inner or nested classes. If you have a private inner or nested class, then access is restricted to the scope of that outer class.
ask:3,asku:1,askr:137,askz:21,askd:152,RedisW:0askR:3,askD:0 mz:hit,askU:0,askT:0askA:4