There are 8 primitive data types in the Java programming language.
They are byte, short, int, long, float, double, char, and boolean. Primitive types are built into the language and are named with reserved keywords; they are distinct from reference types, which refer to objects such as arrays, user-defined classes, and String. Java’s type system therefore does not treat every value as an object at the language level.
A common mix-up is counting String as a primitive. String is extremely common in Java, but it is a class, not one of the eight primitive types. Wrapper classes—such as Integer, Double, and Boolean—are also reference types. Java can automatically convert between some primitives and wrappers through autoboxing and unboxing, which can make the distinction less obvious.
The eight types cover integer values, floating-point values, UTF-16 character units, and true-or-false values. Their fixed categories help Java remain statically typed, while wrapper classes and generics provide object-oriented features when primitives cannot be used directly.