Literals are fixed values expressed in Java source code:
3
, 55.2
, 'c'
, "string"
.Any fixed value that can be expressed with some dedicated syntax in Java is a literal:
- Integers
48123
- Longs
943L
- Doubles
33.2
- Octals
023
- Hexadecimals
0x64
- Characters
'c'
- Strings
"a string"