Java Reference

In-Depth Information

Math Operators

Add

a+b

Subtract

a-b

Multiply

a*b

Divide

a/b

Remainder

a%b
(for whole numbersâ€”integersâ€”only)

Specify order of terms

((a+b)*z)
(a + b will be added first, then multiplied by z)

True-or-False Comparison Operators

Equal to

a==b

Not equal to

a!=b

Less than

a<b

Greater than

a>b

Less than or equal to

a<=b

Greater than or equal to

a>=b

And

a&&b
(must be something that's true or false)

Or

a||b
(must be something that's true or false)

Not

!a
(must be something that's true or false)