Primitive data types are the most basic data types available in Java. They are used as building blocks in order to further manipulate data. Their only objective is to store a particular kind of value, which we will delve into below. They are passed by pass by value.
Primitive Data Types: int, double, char, byte, float, and long
Integers: Integers are essentially non-fractional numbers.
int
. The wrapper class however, is written as Integer
. If a value that is out of range is tried to be directly stored in a variable Eg: int x=283749827489274924
; it will not compile and give you an error like Main.java:17: error: integer number too large
Doubles: They store decimal values.
double
. The wrapper class however, is written as Double
.