why is not (123 == 0123) in java?

前端 未结 3 1486
礼貌的吻别
礼貌的吻别 2020-12-06 09:12

I am developing an application in Android using Eclipse. I wrote the following code and in tests the first and third \"if\" block is not reachable. Why?

3条回答
  •  情深已故
    2020-12-06 10:14

    Any integer Number Leading With Zero is octal Number (base 8).

    0123 is octal Number and 123 is Decimal Number

     0123 = (3*8^0) +(2*8^1)+(1*8^2)+(0*8^4)
            =3+16+64+0
            =83   
    

提交回复
热议问题