TYPE | BYTES | RANGE |
---|---|---|
Byte | 1 | -128 to 127 |
Short | 2 | -32,768 to 32,767 |
Integer | 4 | -2,147,483,648 to 2,147,483,647 |
Long | 8 | -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
Float | 4 | 1.2E-38 to 3.4E+38 |
Double | 8 | |
Char | 1 | A, B, C…. |
Boolean | 1 | true or false |
NOTE: While initialising for float and long, we need to type “f” and "L,” respectively.
Reference types don't store the actual values; they store a reference to an object somewhere in memory.
These are created using a “new” keyword.