Java Reference
In-Depth Information
32-bit floating-point ( IEEE 754)
float
double 64-bit floating-point ( IEEE 754)
For each primitive type there is also a corresponding object type, gen-
erally termed a "wrapper" class. For example, the class Integer is the
wrapper class for int . In most contexts, the language automatically con-
verts between primitive types and objects of the wrapper class if one
type is used where the other is expected.
In the Fibonacci program, we declared hi and lo with initial values of 1.
The initial values are set by initialization expressions, using the = oper-
ator, when the variables are declared. The = operator (also called the
assignment operator), sets the variable named on the left-hand side to
the value of the expression on the right-hand side.
Local variables are undefined prior to initialization. You don't have to
initialize them at the point at which you declare them, but if you try to
use local variables before assigning a value, the compiler will refuse to
compile your program until you fix the problem.
As both lo and hi are of the same type, we could have used a short-
hand form for declaring them. We can declare more than one variable of
a given type by separating the variable names (with their initialization
expressions) by commas. We could replace the first two lines of main
with the single equivalent line
int lo = 1, hi = 1;
or the much more readable
 
Search WWH ::




Custom Search