Java Literals - dummies

By Barry A. Burd

Part of Beginning Programming with Java For Dummies Cheat Sheet

In addition to its keywords, three of the words you use in a Java program are called literals. Each literal has a specific meaning in the language. You can’t use a literal for anything other than its pre-assigned meaning.

The following table lists Java’s literal words.

Literal What It Does
false One of the two values that a boolean expression can possibly have.
null The “nothing” value. If you intend to have an expression refer to an object of some kind, but the expression doesn’t refer to any object, the expression’s value is null.
true One of the two values that a boolean expression can possibly have.

The keywords and literal words are all called reserved words because each of these words is reserved for special use in the Java programming language.