+ 1
Why is 010 not equal to 10?
A Java challenge question asked, "what is the output of the following code? System.out.println(010==10);" The correct answer was false, so my question is why does the leading zero make these values unequal?
5 Réponses
+ 12
010 is an octal value (8), while 10 is decimal.
+ 1
so number starting with 0 is octal in java???...
0
maybe that is string
0
because java accepts it as an octal value, So 010 = 8. while 10 is you know.