Java primitive data type is similar to those of C. Java usage eight primitive data type.
Definition: - A data type is a classification of data which store in specific data . Every primitive data type variable assigned a data type that determine what data type is declared. The term “data type “ and “primitive data type” are often used interchangeable. Primitive data type are predefined type, means if we define preemptive data type , you should assign a value in a variable of those data type like.
int sum = 0;
Java have eight data tpe :-
1. boolean : boolean data type have two possible true and false. Using this data type is simple flag that track true or false condition.
2. char : char data type is single 16-bit Unicode character. char is minimum value of ‘\u0000’ (or 0) and maximum value of ‘\uffff ’ (or 65, 535 inclusive).
3. byte : byte data type is an 8-bit signed two’s complement integer. Byte data type have maximum value of 127 and minimum value of -128 . The byte data type can be use for large array. Where the memory saving matters.
4. short : short data type is 16-bit signed two’s complement integer. It has maximum value of 32,767 and minimum value of -32,768. It can be use for large array.. Where memory saving matter.
5. int : int data type 32-bit signed integer two’s complement integer. It has maximum value of
2,147,483,647 and minimum value of - 2,147,483,648. It has used wider range of integer type. If you need to wider range of this. You can use long instead of this.
6. long : long data type 64-bit signed two’s complements integer. It has maximum value of 9,223,372,036,854,775,807 and minimum value of -9,223,372,036,854,775,808. When you need a range of values wider than those provided by int.
7. float : The float data type is a single-precision 32-bit IEEE 754 floating point . It’s range of beyond the scope.
8. double : The double data type is a double-precision 64-bit IEEE 754 floating point. . It’s range of beyond the scope.
No comments:
Post a Comment