Type | Size | Values That Can Be Stored | |
byte | 8 bits | -128 to 127 | |
short | 16 bits | -32,768 to 32, 767 | |
int | 32 bits | -2,147,483,648 to 2,147,483,647 | |
long | 64 bits | -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
Type | Size | Values That Can Be Stored | |
float | 1.4E-45 to 3.4E+38 | ||
double | 4.9E-324 to 1.7E+308 |
Escape | Meaning |
\n | New line |
\t | Tab |
\b | Backspace |
\r | Carrage return |
\f | Formfeed |
\\ | Backslash |
\' | Single quotation mark |
\" | Double quotation mark |
\d | Octal |
\xd | Hexadecimal |
\ud | Unicode character |
Operator | Meaning | Example |
+ | Addition | 3 + 4 |
- | Subtraction | 5 - 7 |
* | Multiplication | 5 * 5 |
/ | Division | 14 / 7 |
% | Modulus | 20 % 7 |
Expression | Meaning |
x += y | x = x + y |
x -= y | x = x - y |
x *= y | x = x * y |
x /+ y | x = x / y |
Operator | Meaning | Example |
== | Equal to | x == 3 |
!= | Not Equal to | x != 3 |
< | Less than | x < 3 |
> | Greater than | x > 3 |
<= | Less than or equal to | x <= 3 |
>= | Greater than or equal to | x >= 3 |
Operator | Notes |
. [] () | A period . is used for access to methods and variables within objects and classes. Square brackets [ ] are used for arrays. Parentheses ( ) are used to group expressions |
++ -- ! - instanceof | The instanceof operator returns true or false based on whether the object is an instance of the named class or any of that class's subclasses. |
new (type) expression | The new operator is used to create new instances of classes. The parentheses in this case are for casting a value to another type. |
* / % | Multiplication, division, modulus |
+ - | Addition, subtraction |
<< >> >>> | Bitwise left and right shift |
< > <= >= | Relational comparison tests |
== != | Equality |
& | AND |
^ | XOR |
| | OR |
&& | Logical AND |
|| | Logical OR |
? : | Ternary operator |
= += -= *= /= %= ^= | Various assignments |
&= |= <<= >>= >>>= | More assignments |
Operator | Meaning |
+ | Addition |
- | Subtraction |
* | Multiplication |
/ | Division |
% | Modulus |
< | Less than |
> | Greater then |
<= | Less than or equal |
>= | Greater then or equal |
== | Equal to |
!= | Not equal to |
&& | Logical AND |
|| | Logical OR |
! | Logical NOT |
& | AND |
| | OR |
^ | XOR |
= | Assignment |
++ | Increment |
-- | Decrement |
+= | Add and assign |
-= | Subtract and assign |
*= | Multiply and assign |
/= | Divide and assign |
%= | Modulus and assign |