TYPES, VALUES, AND VARIABLES
Variables
4.5
Imported types ( 7.5); here the type
Random
, imported from the type
java.util.Random
of the package
java.util
, is declared
Fields, which are the class variables and instance variables of classes ( 8.3),
and constants of interfaces ( 9.3); here the field
divisor
in the class
MiscMath
is declared to be of type
int
Method parameters ( 8.4.1); here the parameter
l
of the method
ratio
is
declared to be of type
long
Method results ( 8.4); here the result of the method
ratio
is declared to be of
type
float
, and the result of the method
gausser
is declared to be of type
double
Constructor parameters ( 8.6.1); here the parameter of the constructor for
MiscMath
is declared to be of type
int
Local variables ( 14.3, 14.12); the local variables
r
and
val
of the method
gausser
are declared to be of types
Random
and
double[]
(array of
double
)
Exception handler parameters ( 14.18); here the exception handler parameter
e
of the
catch
clause is declared to be of type
Exception
and in expressions of the following kinds:
Class instance creations ( 15.8); here a local variable
r
of method
gausser
is
initialized by a class instance creation expression that uses the type
Random
Array creations ( 15.9); here the local variable
val
of method
gausser
is ini
tialized by an array creation expression that creates an array of
double
with
size 2
Casts ( 15.15); here the
return
statement of the method
ratio
uses the
float
type in a cast
The
instanceof
operator ( 15.19.2); here the
instanceof
operator tests
whether
e
is assignment compatible with the type
ArithmeticException
4.5 Variables
A variable is a storage location and has an associated type, sometimes called its
compile time type
, that is either a primitive type ( 4.2) or a reference type ( 4.3).
A variable always contains a value that is assignment compatible ( 5.2) with its
type. A variable's value is changed by an assignment ( 15.25) or by a prefix or
postfix
++
(increment) or
(decrement) operator ( 15.13.2, 15.13.3, 15.14.1,
15.14.2).
43
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved