What are Java primitive data types?

In Java, primitive data types can be categorized within three types:
  1. Integral types:
    • signed integers : byte,short,int and long.
    • unsigned character values, char,denoting all the 65536 characters in the 16-bit Unicode character set.
  2. Floating-point types: float and double, representing fractional signed numbers.
  3. Boolean type: boolean, representing logical values, the two literals, true or false.

A primitive data value can't act as an object in a Java program unless wrapped. Therefore, each primitive data type has a corresponding wrapper class that can be used to represent its value as an object.

No comments: