0
Can we use the Long data type for a short Value?
Eg:long a=2; Is it correct??
5 Respostas
+ 1
Yes, because the size of long data type is bigger than short.
0
The best practices is to use L or l with numbers when asdiging to long daya type.
ex:
long a = 2L;
Here no casting.
0
ok thanks..It means that long data types' values need casting...Correct
0
As Mazen said, it need L or l with the number.
0
See this post, hope this help
http://stackoverflow.com/questions/14699067/why-is-the-default-type-of-java-integer-literals-int-instead-of-long