标题: [Oracle interview]Can a top level class be private or protected? [打印本页] 作者: 曹凯 时间: 2013-8-16 15:08 标题: [Oracle interview]Can a top level class be private or protected? 作者: 于军 时间: 2013-8-16 15:25
No. A top level class can not 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.