Java Reference
In-Depth Information
Table A.2.2 Arithmetic operators. x and y are numeric or char types. If mixed
floating-point and integer types, then floating-point arithmetic is used and a
floating-point value returned. If mixed integer types, the wider type is returned.
If double and float mixed, double is returned.
Operator
Description
Addition.
x+y
x - y
Subtraction.
Multiplication.
x*y
Division.
If FP arithmetic and y = 0.0, then infinity returned if x is not
zero, NaN if x is zero.
ArthmeticException thrown if x and y are integer types
and y is zero.
x/y
Modulo - remainder of x/y returned.
If floating-point arithmetic and y
x%y
=
0.0 or infinity, then NaN
returned.
ArthmeticException thrown if x and y are integer types
and y is zero.
Unary minus.
Negation of x value.
-x
Search WWH ::




Custom Search