A literal is a fixed value written directly in the source code. When you write 42, 3.14, true, or "Hello" — those are literals. Java supports literals for all primitive types and for strings.
Integer Literals
A literal is a fixed value written directly in the source code. When you write 42, 3.14, true, or "Hello" — those are literals. Java supports literals for all primitive types and for strings.