Literals in Java are the fixed sequence of characters (digit, letters) that are in the form of constant values that are assigned to the variable. Literals can be number, letter or anything which is represented in the form of a constant value.
Literal in Java represents constant value to be stored in variables. Literals are syntactic representations of boolean, character, numeric, or string data.
There are five types of literals:
There are four primitive data types present in integer literals, they are a byte, short, long, int and we can represent these in 4 ways:
#java #java literals