Java automatically upgrades an integer value to long
type by simpling assigning it to a long
variable:
int myInt = 10;
long myLong = myInt;
println(myInt, myLong); // 10, 10
exit();
However, when using literals that exceed 2 ^ 31
we have to suffix them w/ L
or l
:
//long wrongLong = 4_000_000_000;
long correctLong = 4_000_000_000L;
println(correctLong); // 4000000000
exit();