Mark Danishevsky

Tutorials: Primitive Types

Back to tutorials home

Primitive Types Navigation

Primitive types

In Java, primitive types are the most basic data types and are not objects. They store simple values directly in memory. Java has eight primitive data types [Oracle] Primitive Data Types - Java Tutorials:

Name Description Example Values
byte 8-bit signed integer (-128 to 127) 12, -85
short 16-bit signed integer (-32,768 to 32,767) 9 000, -5 200
int 32-bit signed integer (-2³¹ to 2³¹-1) 5 000 000 000, -299 444, 0
long 32-bit floating-point number 15000000000L (the suffix L denotes that it is a long literal)
float 32-bit floating-point number 5.33, -14.44, 3.14159
double 64-bit floating-point number 36.6f (the suffix f denotes that it is a double literal)
char 16-bit 1 single Unicode character (0 to 65,535) A, b, ^, &
boolean Represents true or false true, false

Example: