user image

Pooja Sharma

Job Interview Skills
English
2 years ago

. Can a top level class be private or protected?

user image

Abhishek Mishra

2 years ago

No. A top level class cannot be private or protected. It can have either "public" or no modifier. If it does not have a modifier it is supposed to have a default access. If a top level class is declared as private the compiler will complain that the "modifier private is not allowed here". This means that a top level class can not be private. Same is the case with protected.

Recent Doubts

Close [x]