Data Types

The most basic operation that a program in any programming language performs is manipulation of data. In order to achieve this, every programming language provides different types of data, operators and the syntax for valid statements. In this chapter, we discuss the various data types supported by the Java programming language.

All the data types in Java have been categorized into two—primitive data types and reference data types.

The primitive types, also known as built-in types, are byte, short, int, long, float, double, char and boolean.

The reference data types are arrays, classes, interfaces, enums and annotations. enums and annotations are introduced into the Java programming language from Java 5.


Get The class of Java 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.