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 MainActivity.java file, add the below to the onCreate method. This will create a Double variable named myDouble.
double myDouble;
2. Compile and run!
Resources:
http://developer.android.com/reference/java/lang/Double.html
http://www.tutorialspoint.com/java/java_basic_datatypes.htm
http://msdn.microsoft.com/en-us/library/x99xtshc.aspx
Popular Posts
- android:ellipsize - Add an ellipsis(...) in a TextView
- Save LogCat to a Text File
- Solution: error: Error parsing XML: unbound prefix
- android:nextFocusRight - Set the Next Focus Right to a TextView/EditText
- Intent setType(String type) - How to Set an Explicit MIME data type
- Perform an Action after Enter keypress on EditText
- Cursor getColumnIndex - Get the Index for a Column Name
- android:textColorHint - Set the Color of Hint Text in TextView/EditText
- android:nextFocusDown - Set Next Focus to a TextView/EditText
- Determine the Hex value for a color