Literals are nothing but pieces of Java code that indicate explicit values. For example "Hello IGNOU!" is a String literal.
The double quote marks indicate to the compiler that this is a string literal.
The quotes indicate the start and the end of the string, but remember that the quote marks themselves are not a part of the string.
Similarly, Character Literals are enclosed in single quotes and it must have exactly one character.
TRUE and FALSE are boolean literals that mean true and false. Number, double, long and float literals also exits there.
Literals in java are a secquence of character that represent constant value to be stored in variables.
Java language specifies seven types of literals they are:
1) Number Literals:
-45, 4L, 0777, 0XFF, 2.56F, 10e45, .36E-2
2) Boolean Literals:
TRUE, FALSE
3) Character Literals:
'a', '#', '3', \n, \\, \"
4) String Literals:
"A string with a \t tab in it”
5) Double Literals:
1.5, 45.6, 76.4E8
6) Long Literals:
34L
7) Float Literals:
45.6f, 76.4E8F, 1.5F