Create a Float object

Float(double value)
Creates a Float object from double-type value and convert it to type float.
Float(float value)
Creates a Float object for the primitive float argument.
Float(String s)
Creates a Float object that represents the floating-point value of type float represented by the string.

public class Main {
  public static void main(String[] args) {
    Float float1 = new Float(0.0d);
    Float float2 = new Float(0.1F);
    Float float3 = new Float("0.2");
    
    System.out.println(float1);
    System.out.println(float2);
    System.out.println(float3);
    
  }
}

The output:


0.0
0.1
0.2
Home 
  Java Book 
    Essential Classes  

Float:
  1. Float class
  2. MAX/MIN_VALUE Find out the Maximum value and Minimum value a float type can have
  3. Create a Float object
  4. Convert Float to byte, double, float, int, long and short
  5. Compare two float objects
  6. Infinite and Not A Number
  7. Convert float value to Hex String value
  8. Convert float value to String value
  9. Convert string value to float value
  10. Bit oriented calculation for float