Primitive type literals
A literal is the fourth of the Java tokens listed in the Input types section. It is the representation of a value. We will discuss literals of reference types in the Reference types and String section. And now we will talk about primitive type literals, only.
To demonstrate literals of primitive types, we will use a LiteralsDemo program in the com.packt.javapath.ch05demo package. You can create it by right-clicking on the com.packt.javapath.ch05demo package, then selecting New | Class, and typing the LiteralsDemo class name, as we have described in Chapter 4, Your First Java Project.
Among primitive types, literals of the boolean type are the simplest. They are just two: true and false. We can demonstrate it by running ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access