If i want to initialize a long of 1 or 0 do i need to add L to the end?
long l = 0L;
long k = 1L;
versus
long l = 0;
long k = 1;
Does it matter for low values?
If i want to initialize a long of 1 or 0 do i need to add L to the end?
long l = 0L;
long k = 1L;
versus
long l = 0;
long k = 1;
Does it matter for low values?
If i want to initialize a long of 1 or 0 do i need to add
Lto the end?
Only if the value is larger than will fit in an int. Without the L (or l, but don't use that), the number is an int.
Does it matter for low values?
Not at all. Java's int-to-long conversion is well-defined, and works across the int range.
That doesn't mean that doing so is wrong in any way, of course. You might be doing it for clarity's sake, for instance.