3.4. Primitive Data Types

Java defines eight primitive data types, each of which reside in one of four main types. These main types are shown in Table 3.3.

Table 3.3. Four Main Primitive Data Types
Data Type Purpose
Integral Storing regular numbers
Floating Point Storing decimal point numbers
Textual Storing single text characters
Logical Storing boolean values

These data types are called primitive because they are the only things in Java that are not objects. We will now look at each of them in particular.

3.4.1. Integral Data Types

There are four types of integral data: byte, short, int, and long. These data types are used to store numbers requiring between 8 and 64 bits for storing their values. The default value of an int variable is 0. ...

Get Java™ for ColdFusion® Developers 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.