What are Java's eight primitive data types, and what are their default values and storage sizes?
Java has exactly eight primitives, grouped in three families. The four integer types are byte (8 bits, signed, -128 to 127), short (16 bits, -32768 to 32767), int (32 bits, roughly plus or minus 2.1 billion) and long (64 bits). The two floating point types are float (32 bits) and double (64 bits). The remaining two are char (16 bits, an unsigned UTF-16 code unit) and boolean (1 bit of logical state, although the JVM stores it as a byte in practice).
Default values matter more than most people expect. Every field of a class, and every element of an array, starts at the zero value for its type: 0 for the numeric types, false for boolean, and the null character for char. Local variables are different — they have no default at all, and the compiler refuses to let you read one before you assign it. That asymmetry is deliberate: it removes an entire family of silent-null bugs at the source level.
Two size facts that get asked repeatedly. First, on any Java platform an int is 32 bits and a long is 64 bits, because the Java language specification fixes those widths; the primitive sizes are not chosen to match the underlying CPU. Second, a char is 16 bits because it is a UTF-16 code unit, which is why a supplementary character such as an emoji needs a surrogate pair and therefore two chars — a fact that matters if you are counting characters in user input.
Note also that there is no primitive for decimal money. BigDecimal is a class, and for financial code it is the only correct choice; double and float are binary floating point and cannot represent most decimal fractions exactly.