UUCMS 2025
Data types
In java
Page 10
JAVA
Data type in
java ☕
Tip:
How: Highlight text, click on the link symbol on the
toolbar, and select the page in your presentation
you want to connect.
Back to Agenda Page
JAVA
Introduction: Data types in
java
Java is a statically-typed programming language,
meaning each variable must be declared with a
data type.
Data types specify the type of data a variable can
hold, impacting memory and behavior.
Understanding data types is essential for writing
efficient and error-free Java programs.
JAVA
UUCMS
Types of Data Types
Java has two main categories:
1. Primitive Data Types
2.Non-Primitive Data Types
Primitive Data Types in Java
Primitive data types are predefined by Java and include byte, short,
int, long, float, double, char, and boolean.
These types store simple values directly and are the building blocks of
data manipulation.
Primitive types have fixed sizes and are used for basic operations and
calculations.
Back to Agenda Page
JAVA
1. Primitive Data Types
These are the basic built-in types (8 types total):
Type Description Example
byte Small integer (1 byte) byte a = (-128 to 127 )
short Small integer (2 bytes) short s = (1000 to -1000)
int Whole number (4 bytes) int x = {0,1,2,3,...} • byte - 1 byte (-128 to 127)
• short - 2 bytes (-32,768 to 32,767)
long Large integer (8 bytes) long l = 100000L; • int - 4 bytes (whole numbers)
float Decimal number (4 bytes) float f = 3.14f; • long - 8 bytes (large whole numbers)
• float - 4 bytes (decimal numbers)
double Decimal number (8 bytes) double d = 99.99; • double - 8 bytes (large decimal numbers)
char Single character (2 bytes) char c = 'A';
boolean True/False value (1 bit) boolean flag true/false
JAVA
Non-Primitive Data Types in Java
Non-primitive data types, also called reference types,
. include classes, arrays, and interfaces.
They store references to objects rather than the actual data.
Non-primitive types are more complex and can contain . .
multiple values and methods.
Back to Agenda Page
JAVA
2 . N o n P r i m i t i v e
• S t r i n g - s e q u e n c e o f c h a r a c t e r s
E x a m p l e : " H e l l o J a v a "
• Arrays - collection of similar items
Example: int[] numbers = {1,2,3};
• Classes - user-defined types
• I n t e r f a c e s
JAVA
🔸 Conclusion
Java data types help manage memory and define variable
behavior.
Understanding them is the foundation of Java programming.
JAVA
THANK
YOU!
v_i_n_o_d_dude_b_o_y