How to Declare a Double Variable

The Double class wraps a value of the primitive type double in an object. An object of type Double contains a single field whose type is double.

Holds signed IEEE 64-bit (8-byte) double-precision floating-point numbers that range in value from -1.79769313486231570E+308 through -4.94065645841246544E-324 for negative values and from 4.94065645841246544E-324 through 1.79769313486231570E+308 for positive values. Double-precision numbers store an approximation of a real number.
The Double data type provides the largest and smallest possible magnitudes for a number.
double data type is a double-precision 64-bit IEEE 754 floating point.
This data type is generally used as the default data type for decimal values, generally the default choice.
Double data type should never be used for precise values such as currency.
Default value is 0.0d.
Example: double d1 = 123.4

1. In the file, add the below to the onCreate method. This will create a Double variable named myDouble.

double myDouble; 

2. Compile and run!