The Double class in Java is a wrapper class for the primitive type double. It provides a variety of methods for converting a double to a string and a string to a double, as well as other constants and methods useful when dealing with a double. Understanding these methods is crucial for efficient double manipulation in Java.
This guide covers various methods available in the Double class, offering a comprehensive understanding of how to manipulate and interact with double values in Java. These methods are essential for efficient coding practices and help in performing operations like parsing, comparing, and converting double values.
For more detailed information, you can refer to the official Java SE Documentation and additional resources on Java Programming Tutorial.
Java Double Class Methods
| Method | Description |
|---|---|
| byteValue() | Returns the value of this Double as a byte. |
| doubleValue() | Returns the value of this Double as a double. |
| floatValue() | Returns the value of this Double as a float. |
| isInfinite() | Checks if this Double value is infinitely large in magnitude. |
| isNaN() | Checks if this Double value is not a number (NaN). |
| longValue() | Returns the value of this Double as a long. |
| max() | Returns the greater of two double values. |
| min() | Returns the smaller of two double values. |
| parseDouble() | Parses the string argument as a double. |
| shortValue() | Returns the value of this Double as a short. |
| sum() | Returns the sum of two double values. |
| toString() | Returns a string representation of this Double value. |
| valueOf() | Returns a Double instance representing the specified double value. |
References: