Skip to content

Q 21 - Data Types #25

Discussion options

You must be logged in to vote

📊 Java Data Types

Java data types are divided into two main categories:

1️⃣ Primitive Data Types

These are the most basic types built into the language.

Type Size Description Example
byte 1 byte Smallest integer type byte b = 10;
short 2 bytes Small integer short s = 100;
int 4 bytes Default integer type int i = 1000;
long 8 bytes Large integer long l = 10000L;
float 4 bytes Decimal numbers (single precision) float f = 10.5f;
double 8 bytes Decimal numbers (double precision) double d = 20.99;
char 2 bytes Single character char c = 'A';
boolean 1 bit True or false boolean b = true;

2️⃣ Non-Primitive (Reference) Data Types

These refer to objects and arrays.

Type D…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by AmjustGettingStarted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants