Java Reference
In-Depth Information
On Windows 95, you can use a set statement e.g.:
set CLASSPATH=C:\Gries\prog\vc;C:\jdk\;
In Unix systems
In a Unix system, how you look at and change
CLASSPATH
depends on which
“shell” you are using, so we give only a brief discussion here. Statement
set
or
setenv
may be used to store a value in
CLASSPATH
. In this example:
set CLASSPATH=/usr/Gries/prog/vc:/usr/jdk/lib
the colon is used to separate paths and a slash is used to separate directory names.
But do not set
CLASSPATH
until you know what is already in it —you may want
to add paths to it, not just store a new set of paths in it.
To look at the contents of
CLASSPATH
, try statement
set
without arguments.
Also, look in files like
.login
and
.cshrc
for statements that set
CLASSPATH
.
11.3
The packages that come with Java
An implementation of Java comes with over forty packages, some of which con-
tain subpackages. We mention the more important ones.
Package
java.lang
The most important package (“
lang
” stands for “lan-
guage”). It is automatically imported, so you do not need an import statement for
it. It extends the core language with several classes that you will use often. Here
are the more important classes.
Class
Object
is the root of the hierarchy of classes. Every other class has
Object
as a superclass, so its methods are inherited by all classes. See Sec. 4.3.1.
Classes
String
and
StringBuffer
provide implementations of sequences
of characters. See Sec. 5.2.
The eight wrapper classes, including
Integer
and
Character
, provide
instances that contain the values of primitive types. Class
Void
is used to repre-
sent the primitive Java type
void
. See Sec. 5.1.
Class
Math
contains useful methods, like
abs
,
sin
, and
max
. See Sec 1.1.7.
Class
Class
has methods that provide information about an object. For
example, get the name of the class of object
obj
using
obj.getClass.getName
.
Classes
Throwable
,
Error
,
Exception
, and
RuntimeException
are
involved with exception handling. See Chap. 10.
Package
java.applet
Provides the basic class,
Applet
, for implementing Java
programs that run on the world wide web. See Chap. 16.
Package
java.awt
Contains the classes of the “Abstract Window Toolkit”, which
is used to build GUIs. Some of these classes have been superceded by the Swing
classes —see package
javax.swing
, below.
Package
java.io
Contains the classes that help you do input-ouput, or IO. For
Search WWH ::
Custom Search