0% found this document useful (0 votes)
3 views1 page

Java Data Types

Java offers a variety of data types categorized into primitive and non-primitive types. Primitive data types include byte, short, int, long, float, double, char, and boolean, each with specified sizes and ranges. Non-primitive data types include String, Arrays, Classes, and Interfaces, which store references to objects created by the programmer.

Uploaded by

naryugam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Java Data Types

Java offers a variety of data types categorized into primitive and non-primitive types. Primitive data types include byte, short, int, long, float, double, char, and boolean, each with specified sizes and ranges. Non-primitive data types include String, Arrays, Classes, and Interfaces, which store references to objects created by the programmer.

Uploaded by

naryugam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Java Data Types and Their Ranges

Java provides a rich set of data types to handle different kinds of


data. These are broadly classified into primitive and non-
primitive (reference) data types.
1. Primitive Data Types:

Data Default
Type Size Value Range
byte 1 byte 0 -128 to 127
short 2 bytes 0 -32,768 to 32,767
int 4 bytes 0 -2,147,483,648 to
2,147,483,647
long 8 bytes 0L -9,223,372,036,854,775,808 to
9,223,372,036,854,775,807
float 4 bytes 0.0f ~±3.40282347E+38F (6–7
decimal digits)
double 8 bytes 0.0d ~±1.79769313486231570E+30
8 (15 digits)
char 2 bytes ‘’ 0 to 65,535 (unsigned)
boolea 1 bit false true or false
n

2. Non-Primitive Data Types: - String - Arrays - Classes -


Interfaces
These types are created by the programmer and store references to
objects rather than raw data.
Example Code:
int age = 25;
char grade = 'A';
boolean passed = true;
String name = "Alice";
System.out.println(name + " scored grade " + grade);

You might also like