Java Reference
In-Depth Information
}
In this example, types are used in declarations of the following:
java.util.Random
of the package
java.util
, is declared
• Fields, which are the class variables and instance variables of classes (§
8.3
),
is declared to be of type
int
clared to be of type
long
type
float
, and the result of the method
gausser
is declared to be of type
double
MiscMath
is declared to be of type
int
gausser
are declared to be of types
Random
and
double[]
(array of
double
)
clause is declared to be of type
Exception
able
T
with the type
Number
as its declared bound
• In any declaration that uses a parameterized type; here the type
Number
is
ber>
.
and in expressions of the following kinds:
initialized by a class instance creation expression that uses the type
Random
type argument in the expression
new ArrayList<Number>()
tialized by an array creation expression that creates an array of
double
with
size 2
the method
loop
calls itself with an explicit type argument
S
in a cast