I have a short question about Datatypes. Why do i get this kind of number if i put a leading 0 for a number that i declared to be a long-type? I just dont get what the zero is making to the number.
For example:
1010L -> 1010
0101L -> 65
I have a short question about Datatypes. Why do i get this kind of number if i put a leading 0 for a number that i declared to be a long-type? I just dont get what the zero is making to the number.
For example:
1010L -> 1010
0101L -> 65
In Java integer literals with a leading zero are treated as octal by the compiler.
The leading zero is telling the computer to interpret the number as an octal.
In octal, base eight, the first one represents 64 in base ten, and the last one represents 1:
64 + 1 = 65 (base 10).