java

Java Datatypes


What is Datatype?

  • Datatype specifies which type of value a variable can hold.
     

Java supports two main categories of data types

 

1. Primitive Data Types: These are the basic data types built into the Java language.

 

Datatypes

Sizes

byte

short

int

long

1 byte

2 bytes

4 bytes

8 bytes

float

double

4 bytes

8 bytes

char

boolean

2 bytes

1 bit ( true or false )


2. Non-primitive Data Types: It is also called reference data types, are used to store references to objects.

 

  • Classes
  • Interfaces
  • Arrays