2.1. Primitive variables

[2.1] Declare and initialize variables (including casting of primitive data types)

[2.2] Differentiate between object reference variables and primitive variables

In this section, you’ll learn all the primitive data types in Java, their literal values, and the process of creating and initializing primitive variables. A variable defined as one of the primitive data types is a primitive variable.

Primitive data types, as the name suggests, are the simplest data types in a programming language. In the Java language, they’re predefined. The names of the primitive types are quite descriptive of the values that they can store. Java defines the following eight primitive data types:

Get OCA Java SE 8 Programmer I Certification Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.