Java int division confusing me

我的梦境 提交于 2019-11-27 15:32:39

The value 0200 is an octal (base 8) constant. It is equal to 128 (decimal).

From Section 3.10.1 of the Java Language Specification:

An octal numeral consists of an ASCII digit 0 followed by one or more of the ASCII digits 0 through 7 and can represent a positive, zero, or negative integer.

The value 0200 is an octal, which is 128 in decimal.

For further information, see the literals section of the Primitive Data Types explanation.

divesh premdeep

Observed an interesting behavior here.

If I do an Integer.parseInt("0200"), I get 200 as o/p.

Howzzat ?!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!