Datatype :-
In Computer Science and Computer Programming a datatype is a classification of data which tells the Computer or Interpreter how the programmer intend to use data.Datatypes specify the different sizes and values that can be stored in the variable.
There are Two types of Datatype in JAVA :-
1)- Primitive Datatype.
2)- Non-Primitive Datatype.
Non-Primitive Datatype(User-Define Datatype) :-
In JAVA Non-Primitive datatype or User-Define datatype are the building blocks of Data Manipulation. These are the most basic datatypes available in JAVA.
Non-Primitive datatypes are also called as Reference Types because they refers to objects.
Non-Primitive datatypes include classes, interfaces and arrays.
Non-primitive datatypes are created by the programmer and is not defined by JAVA (except for
String
).Primitive datatype :-
There are 8 primitive datatype supported by Java primitive are predefined by the language and named by a keyword.
A primitive data type specifies the size and type of variable values, and it has no additional methods.
A primitive data type specifies the size and type of variable values, and it has no additional methods.
Integer :-
This group includes.
- byte.
- short.
- int.
- long.
1)- byte :-
It is one one byte integer datatype. it has only 8 bit. the value is range from -128 to 127. the default value is 0.
ex. byte b=10;
2)- short :-
It is 2 byte, 16 bits integer datatype. The value range from -32768 to 32767. The default value of short is 0.
ex. short s=10;
3)- int :-
It is 4 byte, 32 bit integer datatype they are without decimal value. The default value is 0. The value is in the range of -2147483648 to 2147483648.
ex. int i=10;
4)- long :-
It is 8 byte, 64 bit integer datatype . The default value is 0. The range value is -9223372036854775808 to 9223372036854775807.
Floating Point :-
This group includes float and double.
5)- float :-
It is 4 byte, 32 bits float datatype. The default value is 0.0f.
ex. float f=1.5f;
6)- double :-
It is 8 byte, 64 bits double datatype default value is 0.0d.
ex. double d= 1.5;
7)- character :-
This group includes char which represent symbol in a characters, symbol, numbers. it is 1 byte datatype.
ex. char a= '1010';
char c='b';
2)- short :-
It is 2 byte, 16 bits integer datatype. The value range from -32768 to 32767. The default value of short is 0.
ex. short s=10;
3)- int :-
It is 4 byte, 32 bit integer datatype they are without decimal value. The default value is 0. The value is in the range of -2147483648 to 2147483648.
ex. int i=10;
4)- long :-
It is 8 byte, 64 bit integer datatype . The default value is 0. The range value is -9223372036854775808 to 9223372036854775807.
Floating Point :-
This group includes float and double.
5)- float :-
It is 4 byte, 32 bits float datatype. The default value is 0.0f.
ex. float f=1.5f;
6)- double :-
It is 8 byte, 64 bits double datatype default value is 0.0d.
ex. double d= 1.5;
7)- character :-
This group includes char which represent symbol in a characters, symbol, numbers. it is 1 byte datatype.
ex. char a= '1010';
char c='b';
8)- Boolean :-
This group includes boolean value, which is a special type representing true or false, they are defined constant of the language the default value of the boolean is false.
ex. b=true;
0 Comments