Lexical Literals

A literal denotes a fixed, unchanging value.


						Literal:
									IntegerLiteral
									FloatingPointLiteral
									BooleanLiteral
									CharacterLiteral
									StringLiteral
									DayOfWeekLiteral
									GenderLiteral
									NullLiteral

The type of a literal is determined as follows:

  • The type of an integer literal that ends with I or i is int, that ends with L or l is long and that ends with IB or ib is BigInteger; the type of any other integer literal is int.

  • The type of a floating-point literal that ends with F or f is float. The type of a floating-point literal that ends with D or d is double. The type of a floating-point literal that ends with BF or bf is BigDecimal. The type of any other floating-point literal is double.

  • The type of a boolean literal is boolean.

  • The type of a character literal is char.

  • The type of a string literal is String.

  • The type of the null literal null is the null type; its value is the null reference.

Evaluation of a lexical literal always completes normally.