Java Reference
In-Depth Information
The
javadoc
tool, which comes with the SDK, automatically generates
hypertext documentation when operated on Java source code files with special
tags. Starting a comment with a slash and two asterisks indicates comments for
javadoc
,asin
/**
This applet tests graphics.
*/
public class TestApplet extends applet { ...
The command
>
javadoc TestApplet.java
will include this comment in the hypertext description of the class. Several special
comment tags are also available to describe method parameters, return values, and
other items. (Note that asterisks within the comments are ignored by
javadoc
so we often use them to mark the left side of a block of
javadoc
comments.)
See Chapter 6 in the Web Course for more about
javadoc
.
2.5 Data types and Java primitives
How numbers and other data, such as characters, are represented in memory is
of great practical importance. Ideally a single memory representation, or type,
could represent all numerical data. However, computer memory and transfer rates
are not infinite and designers must strike a compromise among the demands for
numerical values to span the widest possible range of values while conserving
memory and maximizing program performance.
Ve ry large numbers and fractional numbers require a floating-point type.
Floating-point operations involve the extra complexity of dealing with both a
significand and an exponent. Therefore, integer data types normally provide
faster performance for operations where floating-point is not required. (Some
processors don't do any floating-point arithmetic at all, only integer arithmetic.)
A single universal numerical data type will not be efficient or sufficient for all
situations.
Table 2.1 lists the eight primitive data types and shows the features of each.
Four integer types provide for efficient use of memory for a given task. The
byte
type (8-bit) is often useful for IO tasks while the
long
type (64-bit) is needed
for representing very large integer values. In between are the 16-bit
short
and
the 32-bit
int
types. The
int
type is the default for most integer operations in
Java. The integer types use two's complement signed representations.
Search WWH ::
Custom Search