Java Reference
In-Depth Information
Review today's material by taking this three-question quiz.
Questions
1.
What packages are automatically imported into your Java classes?
a.
None
b.
The classes stored in the folders of your
CLASSPATH
c.
The classes in the
java.lang
package
2.
According to the convention for naming packages, what should be the first part of
the name of a package you create?
a.
Your name followed by a period
b.
Your top-level Internet domain followed by a period
c.
The text
java
followed by a period
3.
If you create a subclass and override a
public
method, what access modifiers can
you use with that method?
a.
public
only
b.
public
or
protected
c.
public
,
protected
, or default access
Answers
1. c.
All other packages must be imported if you want to use short class names such
as
LinkedList
instead of full package and class names such as
java.util.
LinkedList
.
2. b.
This convention assumes that all Java package developers will own an Internet
domain or have access to one so that the package can be made available for down-
load.
3. a.
All
public
methods must remain
public
in subclasses.
6
Certification Practice
The following question is the kind of thing you could expect to be asked on a Java pro-
gramming certification test. Answer it without looking at today's material or using the
Java compiler to test the code.