1.3k views
2 votes
Can we declare top level classes as private or protected?

User Collector
by
5.7k points

1 Answer

3 votes

Answer and Explanation:

top level class can not be declare as private or protected. It is always public. If we declare a top level class as private then the compiler always complain that the private is not allowed and if we declare top level class as protected then compiler complain that modifier protection is not allowed here. so we can not declare top level class as private or protected

User ChrisProsser
by
5.5k points