Why is 08 not a valid integer literal in Java?

后端 未结 6 813
清歌不尽
清歌不尽 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:49

    From the Java 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.

提交回复
热议问题