A nested class is any class that is declared inside the body of another class or interface. A top-level class is a class that is not a nested class. A top level class can be declared with public or package (default) access. It can be declared final so that it can not be extended. It can be declared abstract meaning that it might contain an abstract method declaration and can not be instantiated. It can also be strictfp meaning that all float and double expression in all nested classes, methods, constructors, and static, instance, and variable initializers are FP-strict. A top level class can be given package access that makes it visible within its package but not outside of the package. It can be given public access meaning that it is visible outside of its package. Unlike some nested classes, a top-level class can not be given private or protected access and can not be declared static.
Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
Joined: Jul 02, 2002
If you are looking for a mock exam that covers declarations and provides detailed explanations of the answers then please try my declarations exam.