There are two types of casting
- Widening Casting
- Narrowing Casting --> Needs to manually cast
From Left to Right of the following we don't need to cast anything
auto cast --> don't need to cast anything like: float(2)
manual cast <-- int(2.5)
| byte | short | char | int | long | float | double |
|---|---|---|---|---|---|---|
| 1 byte | 2 bytes | 2 bytes | 4 bytes | 8 bytes | 4 bytes | 8 bytes |