Any constant value which can be assigned to the variable is called literal/constant.
Integer literal
These are whole numbers without any fractional part, Java integer (signed 32 bits) ranges from -2147483648 to 2147483647. They can be specified in decimal, hexadecimal, octal, or binary formats.
In Java SE 7 and later, numbers are support underscore ( _ ) to separate groups of digits to improve readability, this is useful for large number especially when representing currency.
Floating point literal
Floats are numbers with a fractional part, Java float (32 bits) ranges from 1.40239846e-45f to 3.40282347e+38f, and double (64 bits) ranges from 4.94065645841246544e-324 to 1.79769313486231570e+308. They can be specified in decimal or scientific notation.
Character literal
Character literals represent a single character, enclosed in a pair of single quote (’ ’). Characters as integral literal, which represents the Unicode value or ASCII value of the character, and that integral literal can be specified either in Decimal, Octal, and Hexadecimal forms. But the allowed range is 0 to 65535.
You can perform arithmetic operations on characters, learn more on Arithmetic operation on character.
String literal
These represent a sequence of characters enclosed in double quotes.
Back to parent page: Java Standard Edition (Java SE) and Java Programming
Web_and_App_DevelopmentProgramming_LanguagesJavaLiteralString_LiteralInteger_LiteralCharacter_LiteralFloating_Point_Literal