Float Class wraps a value of type float in an Object. An Object of type Float contains a single filed whose type is float.

The structure of the class Float is given as:

```
public final class java.lang.Float extends java.lang.Number{
//Member Elements
public final static float MAX_VALUE;
//MAX_VALUE=3.400282346638528860 e to the power 38 is the largest positive finite value of type float.
public final static float MIN_VALUE;
//MIN_VALUE=1.40129846432481707 e to the power -45 is the smallest positive finite value of type float.
public final static float NaN;
//NaN=0.0f/0.0f is a non number value of type float
public final static double NEGATIVE_INFINITY;
//produced when a negative number is divided by 0 like -10.0f/0.0f
public final static double POSITIVE_INFINITY;
//produced when a positive number is divided by 0 like 10.0f/0.0f
//constructors
public Float(double value);
//constructs a newly allocated Float Object that represents the argument converted to type float
public Float(float value);
//constructs a newly allocated Float Object that represents the primitive type float argument.
public Float(String str);
//Constructs a newly allocated Float object that represents the floating point value of type float
//represented by String str.The string is converted to a double value by valueOf() method.
//This method may throw NumberFormatException if the string does not contain a parsable number.
//Methods:
public double doubleValue();
public Boolean equals(Object obj);
public Boolean isNaN();
public static int floatToIntBits(float value);
public static Boolean isInfinite(float value);
public static Boolean isNaN(float value);
public static String toString(float value);
public static Float valueOf(String str);
public float floatValue();
public int hashCode();
public static float intBitsToFloat(int bits);
public int intValue();
public Boolean isInfinite();
public long longValue();
public String toString();
}
```

All About Class Float in Java
Reviewed by Animesh Chatterjee
on
October 05, 2018
Rating:

## No comments: