Primitive Type (Java)

Primitive types are Java's eight built-in basic data types that store simple values directly, not as objects. They are byte, short, int, long, float, double, char, and boolean.

Java

Primitives hold their value directly in memory, which makes them fast and lightweight. They are written in lowercase (int, double) to distinguish them from object types like String or Integer.

Each primitive has a matching wrapper class (int/Integer, double/Double) used when an object is required, such as inside collections.

Examples

Java

int count = 10;
double price = 19.99;
char grade = 'A';
boolean passed = true;
System.out.println(count + " " + price + " " + grade + " " + passed);

Output:

10 19.99 A true

Learn it in a lesson

See also

Back to the Dictionary