by Kunal Sir
Data Types/ Data Member in Java: -
What are Data Types?
Data types mean to identify the type of data and associate operations
that can be done on the data values.
Data types define the values that a variable can take.
Java is Statically Typed Programing Language.
What is Statically Typed Programing language?
Statically typed languages are those languages in which the type of
data values or expression that variable will hold is decided during
the compilation time of the program is called statically typed
language.
Is Java Statically Typed Programing language?
Yes, Java language is a statically typed language, which means the
type of particular variable is defined during the compilation time of
the program.
Stop, Near, 1st Floor, Above Rupam Sweets/ Priyanka Collections Building Vikas Mitra Mandal Chowk
Road, Karve Nagar, Pune, Maharashtra 411052, Mobile No.- 8888022204
by Kunal Sir
That means in the above snippet the number variable is defined for
storing int values if we try to assign other data values the java
compiler will raise an error that is why java language is statically
typed language.
Types of Data Types in Java: -
There are two types of data types
1. Primitive Data Type
2. Non-Primitive Data Type
Stop, Near, 1st Floor, Above Rupam Sweets/ Priyanka Collections Building Vikas Mitra Mandal Chowk
Road, Karve Nagar, Pune, Maharashtra 411052, Mobile No.- 8888022204
by Kunal Sir
1. Primitive Data Type: -
Primitive data types are those data types that are
predefined in the java programming language.
There are a total of eight primitive data types that are
predefined in the java programming language.
The size of primitive data types is fix.
Now we can see the default value, size and range of these
data types are given below-
Stop, Near, 1st Floor, Above Rupam Sweets/ Priyanka Collections Building Vikas Mitra Mandal Chowk
Road, Karve Nagar, Pune, Maharashtra 411052, Mobile No.- 8888022204
by Kunal Sir
2. Non-Primitive Data Type: -
These are the data types that are not predefined but
defined by the programmer according to the need for a
particular task.
Default value of non-primitive data type is “null”.
Stop, Near, 1st Floor, Above Rupam Sweets/ Priyanka Collections Building Vikas Mitra Mandal Chowk
Road, Karve Nagar, Pune, Maharashtra 411052, Mobile No.- 8888022204
by Kunal Sir
Everything inside the java except the primitive data type is
non primitive data types
For example – String, Arrays, Class etc.
Non- primitive is also known as user-define data type.
Non- primitive is also known as reference data type.
Stop, Near, 1st Floor, Above Rupam Sweets/ Priyanka Collections Building Vikas Mitra Mandal Chowk
Road, Karve Nagar, Pune, Maharashtra 411052, Mobile No.- 8888022204