TYPES, VALUES, AND VARIABLES
Integer Operations
4.2.2
Primitive values do not share state with other primitive values. A variable
whose type is a primitive type always holds a primitive value of that same type.
The value of a variable of primitive type can be changed only by assignment oper
ations on that variable.
The
numeric types
are the integral types and the floating point types.
The
integral types
are
byte
,
short
,
int
, and
long
, whose values are 8 bit,
16 bit, 32 bit and 64 bit signed two's complement integers, respectively, and
char
, whose values are 16 bit unsigned integers representing Unicode characters.
The
floating point types
are
float
, whose values are 32 bit IEEE 754 float
ing point numbers, and
double
, whose values are 64 bit IEEE 754 floating point
numbers.
The
boolean
type has exactly two values:
true
and
false.
4.2.1 Integral Types and Values
The values of the integral types are integers in the following ranges:
For
byte
, from 128 to 127, inclusive
For
short
, from 32768 to 32767, inclusive
For
int
, from 2147483648 to 2147483647, inclusive
For
long
, from 9223372036854775808 to 9223372036854775807, inclusive
For
char
, from
\u0000
to
\uffff
inclusive, that is, from 0 to 65535
4.2.2 Integer Operations
Java provides a number of operators that act on integral values:
The comparison operators, which result in a value of type
boolean
:
N
The numerical comparison operators
<
,
<=
,
>
, and
>=
( 15.19.1)
N
The numerical equality operators
==
and
!=
( 15.20.1)
The numerical operators, which result in a value of type
int
or
long
:
N
The unary plus and minus operators
+
and
( 15.14.3, 15.14.4)
N
The multiplicative operators
*
,
/
, and
%
( 15.16)
N
The additive operators
+
and
( 15.17.2)
N
The increment operator
++
, both prefix ( 15.14.1) and postfix ( 15.13.2)
N
The decrement operator
, both prefix ( 15.14.2) and postfix ( 15.13.3)
31
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