Why is 08 not a valid integer literal in Java?

后端 未结 6 830
清歌不尽
清歌不尽 2020-11-22 06:30

Why is 08 considered an out of range int but 07 and below are not?

6条回答
  •  别那么骄傲
    2020-11-22 06:43

    Leading zero means the value is in octal. 8 is not an octal digit, no more than 2 is valid in binary or G is valid in hexadecimal.

提交回复
热议问题