java.lang.Float
class is to wrap float(primitive type) value in an object, as every one know that in Java floats are not objects, they supposed to be wrapped. This class hire the methods from java.lang.Object. Following is the class declaration of java.lang.Float class.
[java]
public final class Float
extends Number
implements Comparable<Float>
[/java]
The functionality of java.lang.Double
class is to wrap the double(primitive type) value in an object, in Java doubles are also not objects so they supposed to be wrapped. This class hires the methods from java.lang.Object. Following is the class declaration of java.lang.Double class.
[java]
public final class Double
extends Number
implements Comparable<Double>[/java]
Methods | Description |
---|---|
doubleValue() | To return the double value of the float. |
floatValue() | float value of the Float object will be returned. |
isNaN() | If float value is Nan(Not-a-Number) then it returns true. |
toString() | String indication of the float object will be returned. |
longValue() | To return long value of float. |
Fields | Description |
---|---|
MAX_VALUE | Maximum value a float can have. |
MIN_VALUE | Minimum value a float can have. |
NEGATIVE_INFINITY | To hold the negative infinity of float type. |
POSITIVE_INFINITY | To hold the positive infinity of float type. |
Methods | Description |
---|---|
isInfinite() | If the given number is huge in magnitude then it returns true. |
longValue() | Long value of the Double will be returned. |
hashCode() | hashcode for the double will be returned. |
floatValue() | Float value of the double will be returned. |
Fields | Description |
---|---|
MAX_VALUE | Maximum value a float can have. |
MIN_VALUE | Minimum value a float can have. |
NEGATIVE_INFINITY | To hold the negative infinity of float type. |
POSITIVE_INFINITY | To hold the positive infinity of float type. |
toString(double)
method is used to return a string for the double value.