>>1)When you declare a
long variable without the (L or l) does it default to
int ?
Yes. In your example
when
Java encounters 255, it treats it as an
int. Since the
long it is putting 255 into is wider than an
int, there's no problem.
For this next exercise, keep in mind that Integer.MAX_VALUE = 2147483647:
This code will not compile! Since 1234567891011 has no suffix, Java tries to treat it like an
int, but then it can't fit that behemoth into
int's thirty-two bits, and the compiler complains:
To remedy this problem, you need to say
Good luck, Edmund.
Art