What are the data types supported in Java

Java supports several data types, which can be categorized into two main groups: primitive data types and reference data types. The primitive types include byte, short, int, long, float, double, char, and boolean. Reference types include objects and arrays.

Here's a brief overview of each primitive data type:

  • byte: 8-bit signed integer
  • short: 16-bit signed integer
  • int: 32-bit signed integer
  • long: 64-bit signed integer
  • float: 32-bit floating-point
  • double: 64-bit floating-point
  • char: single 16-bit Unicode character
  • boolean: true or false value

Reference data types are used to refer to objects and are created using classes.


Java data types primitive types reference types byte short int long float double char boolean