PDA

View Full Version : What is literal in Java?



kajalescort
10-26-2021, 06:19 PM
What is literal in Java?

Akshay_M
03-14-2022, 12:38 PM
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