Module java.base
Package java.lang

Class Float

All Implemented Interfaces:
Serializable, Comparable<Float>, Constable, ConstantDesc

public final class Float extends Number implements Comparable<Float>, Constable, ConstantDesc
The Float class wraps a value of primitive type float in an object. An object of type Float contains a single field whose type is float.

In addition, this class provides several methods for converting a float to a String and a String to a float, as well as other constants and methods useful when dealing with a float.

This is a value-based class; programmers should treat instances that are equal as interchangeable and should not use instances for synchronization, or unpredictable behavior may occur. For example, in a future release, synchronization may fail.

Floating-point Equality, Equivalence, and Comparison

The class java.lang.Double has a discussion of equality, equivalence, and comparison of floating-point values that is equally applicable to float values.

Decimal ↔ Binary Conversion Issues

The discussion of binary to decimal conversion issues in java.lang.Double is also applicable to float values.
See Also: