Java – Float

Java – Float 2017-08-09T12:47:33+00:00

Java Float class :

Java float class encapsulates a float value. It defines several constants the largest and smallest values are stored in MAX_VALUE and MIN_VALUE. The constant NaN indicates that a value is not a number. If you divide a floating – point number by zero, the result is NaN.

This class defines these constructors:

Float(float f)

Float(double d)

Float(String str)

Here, f and d are float and double types to be encapsulated in a Float object.

str is the string representation of a float value.

EX :


Output :
Object f1 = 123.5626
Object f2 = 854.32
Minimum Value of Float = 1.4E-45
Maximum Value of Float = 3.4028235E38
Byte value of Float = 123
Short value of Float = 123
Integer value of Float = 123
Double value of Float = 123.5625991821289
(f1==f2) ?= false
f1.compareTo(f2) = -1
f1 is not a number = false

Prev Next