Which access levels can a top-level Java class be declared with?
Correct answer B. public or package-private
Explanation
A top-level class is either public, and visible everywhere, or has no modifier and is visible only inside its package. The modifiers protected and private apply only to member classes, because they describe access relative to an enclosing class. Declaring a top-level class private is a compile-time error.
Answer checked How we write and check questions
Discussion