What is literal in Java?
What is literal in Java?
Literals are the actual values that are of specific data type. For eg. if you say that a car is a data type, then range rover is a literal. Formal explanation is that int is a data type and say the value 7 is a literal. I am giving below, a representation which can explain you possibly more efficiently.
Data Type Possible Literal
int 33
byte 6
short 94
long 53092437L
char 'c'
boolean true or false
float 1.053f
double 3.03532453