To understand literals, let's take an example to assign value to a variable.
Here,
is a data type.
is variable.
is literal. A Literal is the source code representation of a fixed value. Values like
that appear directly in a program without requiring computation are literals.
In the above example,
is a variable. Since it's a boolean type variable, it may store either false or true. For the compiler to understand it, it requires computation. However, literals like
represents fixed value.