DEV Community

Saravanan B
Saravanan B

Posted on • Updated on

Core Java - Data Types

In java there are Primitive and Reference data types.

Primitive - byte, short, int, long, char, float, double, boolean.

Reference - Class, Array, String etc..

Byte - 1byte - (-128 to +127 range).
Short - 2byte - -32768 to 32767 range.
int - 4byte - -2^31 to 2^31-1
long - 8byte - -2^63 to 2^63-1
char - 2bytes
float - 4byte
double - 8byte

Type Casting --
Implicit - automatically type cast happens (lower -> higher)
Explicit - every time we need to type cast (higher -> lower).

Implicit

Image description

Image description

Top comments (0)