Page 24 - JAVA Programming
P. 24
23
double
Generally, we prefer to use the float data type for decimal values
unless if there is no issue with memory. As it has a precision up to 15
decimals, it is safe to use double for large calculations. We can
optionally use the suffix d or D to end the floating type value. That is,
both 19.67 and 19.67d are the same. The double data type is a double-
precision 64-bit floating-point, based on the IEEE 754 format (double-
precision floating-point numbers).
Syntax:
double myDouble = 256.7879837 ;
Size:
8 bytes (64 bits)
Values:
Real numbers up to 15 decimal digits.
Default Value:
0.0
boolean
A boolean data type is a 2-valued data type that is declared with the
boolean keyword. It is capable of storing only two possible values i.e.,
true and false. This data type is used for flag generations, to check the
true or false conditions. Boolean data type stores only 1-bit
information and size is not precisely defined.
Syntax:
boolean myBool = false ;
Size:
Machine-dependent
Values:
true, false Default Value: False