Data types in JAVA
Data types in Java: easy ICSE Class 10 Computer Science notes with Java examples for students.
Data types
It is a format that any variable is able to store.
In java there are two types of data types.
Primitive and Non primitive.
Primitive data types:-
The fundamental datatypes that are integral part of the java are called primitive data types.
These are given to the user by the java compiler. All the primitive data types have a fixed size. Whenever programmer creates a variable using the primitive data types that particular no. Of bytes are reserved in memory.
They are ready to use data types.
The user can make an instance of the data type and use it to store a particular type of data.
There are 8 primitive data types and theirs sizes(the no of bytes they reserve in the memory)
int size 4 bytes
float 4 byes
long 8 bytes
double 8 bytes
char 2 bytes byte 1 byte boolean 1 bit short. 2 bytes
Non primitive data types:-
These are called user defined data types also, because they are created with the help of primitive data types by the user.
The size is not fixed.
Array, class and interface are examples of non primitive data types.
Related Posts
Continue learning with these related articles

Logic Gates for ISC Class 11: Truth Tables, Universal Gates, Half and Full Adder
ISC Class 11 Computer Science notes on logic gates: AND, OR, NOT, NAND, NOR, XOR and XNOR with truth tables, why NAND and NOR are universal gates, and half adder and full adder circuits with their Boolean expressions.
Decimal to Binary Conversion in Java: 3 Programs with Examples
How to convert a decimal number to binary on paper and in Java: three programs (String, place value and Integer.toBinaryString), binary to decimal, a dry run and common mistakes.
Sum of First n Natural Numbers in Java (Loop and Formula)
Find the sum of the first n natural numbers in Java with a for loop, a while loop and the formula n(n + 1)/2, with a dry run and the sums of even numbers, odd numbers, squares and cubes.