Why can't we define a top level class as private?

前端 未结 10 2113
情书的邮戳
情书的邮戳 2020-12-07 12:38

Why does Java not allow a top level class to be declared as private? Is there any other reason other than \"We can\'t access a private class\"?

10条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-07 13:20

    Java doesn’t allow a top level class to be private. Only 'public' or 'package'.

提交回复
热议问题