This is a draft cheat sheet. It is a work in progress and is not finished yet.
Data Types
Type |
Contains |
range |
boolean |
1 byte |
True or False |
char |
16 bytes |
byte |
8 bits |
-128 to +127 |
short |
16 bits |
-32768 to 32767 |
int |
4 bytes |
-2147483648 to 2147483647 |
long |
8 Bytes |
-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
float |
4 bytes |
+_3.410-38 to +-3.41037 with 7 digits |
double |
8 Bytes |
+-1.710-308 to +-1.710308 with 15 digits |
Combined Assignment Operators
Operator |
Example |
Equivalent |
Value of variable after operation |
+= |
x += 5; |
x = x + 5; |
the old value of x plus 5 |
-= |
y -= 2; |
y = y - 2; |
the old value of y minus 2 |
*= |
z *= 10; |
z = z * 10; |
the old value of z times 10 |
/= |
a /= b; |
a = a / b; |
old value of a divided by b. |
%= |
c %= 3; |
c = c % 3; |
the remainder of the division of the old value of c divided by 3 |
|
|
|
|
|