Dremendo Tag Line

Data Types in Java Programming Language

Java Basic Concepts

In this lesson, we will learn about the Data Types in the Java programming language along with a built-in data types table.

What is Data Type

Data Type in Java is used during variable declaration to restrict the type of data to be stored. Whenever a variable is defined in Java, the compiler allocates some memory for that variable based on the data type with which it is declared. Java supports the following data types given below.

data types in Java programming language
  • The short name of Integer data type is int.
  • The short name of Short data type is short.
  • The short name of Byte data type is byte.
  • The short name of Long data type is long.
  • The short form of Float data type is float.
  • The short form of Double data type is double.
  • The short form of Character data type is char.
  • The short form of Boolean data type is boolean.
video-poster

Below table summarizes the built-in data types in Java

Data Type Storage Size Range
boolean 1 bit true or false
byte 1 byte -128 to 127
char 2 bytes 0 to 65535
short 2 bytes -32768 to 32767
int 4 bytes -2,147,483,648 to 2,147,483,647
long int 4 bytes -2,147,483,648 to 2,147,483,647
long 8 bytes -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
float 4 bytes -1.4e-045 to 3.4e+038 (upto 7 decimal digits)
double 8 bytes -4.9e-324 to 1.8e+308 (upto 15 decimal digits)

Test Your Knowledge

Attempt the multiple choice quiz to check if the lesson is adequately clear to you.

Test Your Knowledge