Data Types in Java | Java Tutorial

Data types in java specify the size and type of values that can be stored in an identifier.

Data Types

There are two types of Data Types in Java.

1. Primitive Data Type
2. Non-primitive Data Type

Primitive Data Type:

There are 8 primitive data types such as byte, short, int, long, float, double, char, and boolean. Size of these 8 primitive data types wont change from one OS to other.

byte, short, int & long – stores whole numbers
float, double – stores fractional numbers
char – stores characters
boolean – stores true or false

Non-primitive Data Type:

Non-primitive data types include Classes, Interfaces and Arrays which we will learn in coming tutorials.

Sample Program:


Must Read: Java Tutorial

Sharing is caring.

Share on facebook
Share on twitter
Share on linkedin

Like This Post?

We have a lot more where that came from?

We only send really good stuff occasionally, promise.


Leave a Comment

API Testing eBook