elibraryportal Logo

Data Types in Java

  • Every variable is assigned a data type
  • Data type specifies the size and type of values that can be stored in an identifier.

There are Two types of Data Type that is.

  1. Primitive Data Types
  2. Non-Primitive Data Types
Java Data Types
Data Type Default Value Default size
boolean false 1 bit
char '\u0000' 2 byte
byte 0 1 byte
short 0 2 byte
int 0 4 byte
long 0L 8 byte
float 0.0f 4 byte
double 0.0d 8 byte

1) Primitive Data Types

Java Primitive Data Types include Integer, Character, Boolean, and Floating Point e.t.c.

Integer Primitive Data Types

Integer Data Types can hold whole numbers such as 123 and -96.

Floating Point

Floating point data types are used to represent numbers with a fractional Part.


It can hold only a single character because char stores unicode character sets

Next TopicJava Operators