Classes that are declared outside of any class are known as top-level classes. Java
scopes, and which help you implement top-level class architecture.
There are four kinds of nested classes: static member classes, nonstatic member
Java supports the partitioning of top-level types into multiple namespaces, to better
plish these tasks.
The package statement identifies the package in which a source file's types are loc-
to look for unqualified type names during compilation.
be represented by an error code or object, Java uses objects because error codes are
meaningless and cannot contain information about what led to the exception.
classes are rooted in Throwable . Moving down the throwable hierarchy, you en-
counterthe Exception and Error classes,whichrepresentnonerrorexceptionsand
Exception and its subclasses, except for RuntimeException (and its sub-
classes), describe checked exceptions. They are checked because the compiler checks
the code to ensure that an exception is handled where thrown or identified as being
have to handle these exceptions because they represent coding mistakes (fix the mis-
The throw statement throws an exception to the JVM, which searches for an appro-
clause, unless the name of the exception's superclass is listed in this clause.
A method handles one or more exceptions by specifying a try statement and appro-
not an exception is thrown, and before a thrown exception leaves the method.
with the ext statement; otherwise, an error that identifies the cause of failure is thrown.