In this article we will learn about Data Types in Java.
Data Types in Java
Simply, Data Type refers to the type of data that can be stored in a variable. But internally a data type tells the compiler or interpreter how the programmer is going to use that variable, which value the programmer is going to assign and finally which operations can be performed on those values.
More important an Operating System(OS) assigns memory and reserve that memory space for a particular type of value based on the data type of the variable.
As Java is statically typed language, so a variable in java must be declared with specified type before use.
There are 2 types of data types in Java.
- Primitive data type
- Non Primitive data type
Primitive Data Type:
Primitive data types are the most basic data types which are used for data manipulation and behaves as the building block of non-primitive data type.
Generally primitive data types hold a single value. When a program is executed, compiler recognizes these primitive datatypes as these are hard coded into it.
There are 8 types of primitive data types.
Non-Primitive Data Type:
These non-primitive data types refers to objects. So it is also called as Reference data type which contains a memory address of variable values as it does not store the variable value directly in memory. These variables are not created by Java rather created by the programmers.
Some of the non-primitive data types are
- Arrays etc.
Provided list of Simple Java Programs is specially designed for freshers and beginners to get familiarize with the concepts of Java programming language and become pro in coding.