Java Reference
In-Depth Information
Comments
Java supports two kinds of comments: the traditional comment where all the text from the
ASCII characters /* to the ASCII characters */ is ignored, and single-line comments where
all the text from the ASCII characters // to the end of the line is ignored.
Reserved Words
The following tokens are reserved for use as keywords in Java and cannot be used as iden-
tifiers:
abstract const finally int public this
boolean continue float interface return throw
break default for long short throws
byte do goto native static transient
case double if new strictfp try
catch else implements package super void
char extends import private switch volatile
class final instanceof protected synchronized while
Operators
The following tokens serve as operators in Java:
? = == ! ~ != / /= + += ++ -
-= -- * *= % %= >> >>= >>> >>>= >= >
<< <<= <= < ^ ^= | |= || & &= &&
Separators
The following tokens serve as separators in Java:
, . [ { ( ) } ] ;
Identiers
The following regular expression describes identifiers in Java:
<identifier>=(a-z|A-Z|_|$){a-z|A-Z|_|0-9|$}
Literals
An escape ( ESC ) character in Java is a \ followed by n , r , t , b , f , ' , " , or \ . An octal
escape ( OCTAL_ESC )|provided for compatibility with C|is an octal digit (0{7), or an octal
digit followed by another octal digit, or one of 0, 1, 2, or 3 followed by two octal digits. In
addition to the true , false , and null literals, Java supports int , long , float , double ,
char , and String literals as described by the following regular expressions:
<int_literal>=0|(1-9){0-9}//decimal
|0(x|X)((0-9)|(A-F)|(a-f)){(0-9)|(A-F)|(a-f)}//hexadecimal
|0(0-7){0-7}//octal
<long_literal>=<int_literal>(l|L)
<float_literal>=(0 9){0 9}.{0-9}[(e|E)[+|-](0-9){0-9}][f|F]
|.{0-9}[(e|E)[+|-](0-9){0-9}][f|F]
|(0-9){0-9}[(e|E)[+|-](0-9){0-9}](f|F)
|(0-9){0-9}((e|E)([+|-](0-9){0-9})[f|F]
 
Search WWH ::




Custom Search