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:

Output:

Must Read: Java Tutorial

Get our latest blog posts delivered to your inbox

Subscribe and get popular blog posts about software testing industry.

Rajkumar

Leave a Comment

Share via
Copy link
Powered by Social Snap