1. Data Type in Java

a. Data Type is most important thing of the class because it is used to store the values.
b. Data is a group of Information.
c. Each and every Information has own type. So java Provide different type of data type to hold different type of values.
d. There are two type of Data Type in Java :
- Primitive Data Type
- Non-Primitive Data Type
Primitive Data Type
Non-Primitive Data Type
- Classes : Predefine (String,System,Scanner,Integer,Float,Thread,etc.) User define(Car,MyClass,Demo,Test etc.)
- Array : int [],Integer[] etc.
- Interface : It just like class.
- enum : It is used to define constant.
- All non-primitive default value is null.
a. Primitive Data Types are Old Data type or Lagecy Data type.
b. Primitive Data Types are never create instance.
c. Primitive Data Types are also called variables.
d. There are following primitive data type:
Type | Size | Default Value | Range |
---|---|---|---|
boolean | 1 bit | false | true/false |
byte | 8 bit | 0 | -128 to 127 |
short | 16 bit | 0 | -32768 to 32767 |
char | 16 bit | \u0000 | \u0000 to \uFFFF |
int | 32 bit | 0 | -2147483648 to 2147483647 |
long | 64 bit | 0 | -9223372036854775808 to 9223372036854775807 |
float | 32 bit | 0.0 | 1.4E-45 to 3.4028235E+38 |
double | 64 bit | 0.0 | 4.9E-324 to 1.7976931348623157E+308 |
a. Non-Primitive Data Types are New Data type.
b. Non-Primitive Data Types instance can be created.
c. Non-Primitive Data Types are also called refrence variables.
d. There are following non-primitive data type:
0 Comments