0% found this document useful (0 votes)
8 views7 pages

Data Types

The document outlines data types in Java, categorizing them into primitive and non-primitive types. It details various primitive data types such as byte, short, int, long, float, double, char, and boolean, including their memory usage and value ranges. The choice between int and long is emphasized based on the required value range.

Uploaded by

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

Data Types

The document outlines data types in Java, categorizing them into primitive and non-primitive types. It details various primitive data types such as byte, short, int, long, float, double, char, and boolean, including their memory usage and value ranges. The choice between int and long is emphasized based on the required value range.

Uploaded by

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

Data TY PES in

java
Data ty pes

Data ty pes are the different v alues, that can


be stored in the v ariable
There are tw o ty pes
Data
ty pes
Primitive Non - Primitive

By te
String
Short
Array s
Int
Etc..
Long
Float
Double
Boolean
Primitive data
TY PES
[Link] te
Minimum : - 127
Maximum : 127
Default value is 0
[Link]
Minimum : - 32768
Maximum : 32767
Default value is 0
[Link]
W hen you declare a variable as int a =10: it tak es up 4
by tes of memory
Minimum : - 2147483648
Maximum : 2147483643
[Link] g
W hen you declare a variable as long a = 10: it tak es up 8
by tes of memory
Minimum : - 92233720368547775808
Maximum : 92233720368547775808
The choice betw een using int and long should be based on the
range of value you need to store
[Link]
It tak es 4 by tes
Can tak e up 6 to 7 decimal
Ex: 10.345f

[Link]

It tak es 8 by tes
Can tak e up to 15 decimal
Ex: 10.134256194
[Link]
It tak es 2 by tes
Used to store any
character.

[Link]
There are only tw o
possible value
True
False
Than k y ou

You might also like