Data Types in Java Tutorial

Data type of variable states that what kind of value it can hold and how much memory occupied by it. Java is strongly typed language. Java has following two data types.

  • Primitive data types
  • Non-primitive data types

Primitive

Primitive types are the basic data types available within the Java language. Primitive data types are furthered categorized into following.

  • Integral (byte,short,int,long)
  • Floating-point(float,double)
  • Boolean(boolean)
  • Character(char)

Non-primitive

  • String
  • Array

 

Data TypeDefault ValueSize
byte01 byte
short02 bytes
int04 bytes
long0L8 bytes
float0.0f4 bytes
double0.0d8 bytes
booleanfalse1 bit
char’\u0000′2 bytes

 

 

Leave a Reply