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
- Perform an Action after Enter keypress on EditText
- Intent setType(String type) - How to Set an Explicit MIME data type
- android:scrollbarStyle - Change the Scrollbar Location/Style in a TextView
- Determine the Hex value for a color
- android:ellipsize - Add an ellipsis(...) in a TextView
- android:alpha - Set the Opacity/Transparency of Text in TextView/EditText
- How to Register an Activity that Responds to NFC tags for URI's that point to a URL
- How to Add a Toast
- How to Install an SDK package
- android:drawablePadding - Add Padding to a Drawable in a TextView, in XML