3.10.1
Integer Literals
LEXICAL STRUCTURE
An integer literal is of type
long
if it is suffixed with an ASCII letter
L
or
l
(ell); otherwise it is of type
int
( 4.2.1). The suffix
L
is preferred, because the let
ter
l
(ell) is often hard to distinguish from the digit
1
(one).
A decimal numeral is either the single ASCII character
0
, representing the
integer zero, or consists of an ASCII digit from
1
to
9
, optionally followed by one
or more ASCII digits from
0
to
9
, representing a positive integer:
DecimalNumeral:
0
NonZeroDigit Digits
opt
Digits:
Digit
Digits Digit
Digit:
0
NonZeroDigit
NonZeroDigit: one of
1 2 3 4 5 6 7 8 9
A hexadecimal numeral consists of the leading ASCII characters
0x
or
0X
fol
lowed by one or more ASCII hexadecimal digits and can represent a positive,
zero, or negative integer. Hexadecimal digits with values 10 through 15 are repre
sented by the ASCII letters
a
through
f
or
A
through
F
, respectively; each letter
used as a hexadecimal digit may be uppercase or lowercase.
HexNumeral:
0 x
HexDigit
0 X
HexDigit
HexNumeral HexDigit
The following production from 3.3 is repeated here for clarity:
HexDigit: one of
0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F
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.
OctalNumeral:
0
OctalDigit
OctalNumeral OctalDigit
OctalDigit: one of
0 1 2 3 4 5 6 7
20
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved