Java has 8 Primitive Data Types built directly into the language for maximum speed and low memory usage, plus Non-Primitive (Reference) Types like String, Arrays, and Classes.
The 8 Primitive Types & Sizes
byte(1 byte): -128 to 127short(2 bytes): -32,768 to 32,767int(4 bytes): ~ -2.14B to 2.14B (default for whole numbers)long(8 bytes): Large integers (suffix withL, e.g.,9000000000L)float(4 bytes): Single-precision decimal (suffix withf, e.g.,3.14f)double(8 bytes): Double-precision decimal (default for decimals)char(2 bytes): Single Unicode character in single quotes ('A')boolean(1 bit):trueorfalse
ADVERTISEMENT