Java Data Types

Manorama
2 min readMay 24, 2024

Two types of Data types

1-Primitive

2-Non-primitive

Primitive Data Types-

There are 8 data types predefined in Java, known as primitive data types.

1.Integer

2. Byte

3.Short

4.Long

5.Double

6.Boolean

7.Float

8.Character

1. Integer Type

The int data type can have values from -231 to 231–1 (32-bit signed two’s complement integer).

2.Byte Type

The byte data type can have values from -128 to 127 (8-bit signed two’s complement integer).

3.Short Type

The short data type in Java can have values from -32768 to 32767 (16-bit signed two’s complement integer).

4.Long Type

The long data type can have values from -263 to 263–1 (64-bit signed two’s complement integer).

5.Boolean Type

The Boolean data type has two possible values, either true or false.

6.Double Type

The double data type is a double-precision 64-bit floating-point.

7.Float Type

The float data type is a single-precision 32-bit floating-point.

8.Char Type

The char data type is used to store a single character. The character must be surrounded by single quotes, like 'A' or 'c'.

Outputs:

--

--