Java Reference
In-Depth Information
Answers to Review Questions
1.
Packages allow you to organize your classes that share a common theme or are
closely associated with each other. Packages also create a namespace for the classes
within the package.
2.
The default package.
3.
The fields of B, along with the public and protected fields of A, so the answer is y, z,
s, and t.
4.
C will only have access to the public fields of A and B, so C will only have access to
the fields y and t.
5.
The directory names must match the package names. A.class must be in a folder
named \a, and B.class must be in a folder named \b.
6.
The fully qualified names include the package name, so the answer is a.A and b.B.
7.
The folder that represents the package name should not appear in the CLASSPATH
environment variable, so the answer is c:code\review.
8.
java.lang is implicitly imported into each source file.
9.
encapsulation.
10.
False because no instance of a class is needed.
Search WWH ::




Custom Search