Data Types in Java

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:

Output:

Must Read: Java Tutorial

Rajkumar SM is a founder of SoftwareTestingMaterial. He is a certified Software Test Engineer by profession and blogger & youtuber by choice. He has an extensive experience in the field of Software Testing. He writes here about Software Testing which includes both Manual and Automation Testing. He loves to be with his wife and cute little kid 'Freedom'.

Leave a Comment

Share via
Copy link
Powered by Social Snap