Float Data Type In Java

Float Data Type ?

Float data type is a single-precision 32-bit IEEE 754 floating point.

It has 32 bits data type. It can be ranged from 3.402823E38 to -1.401298E-45 for negative values and 1.401298E-45 to 3.402823E38 for positive values.


Float is mainly use to save memeory in large arrays of floating point numbers.

Float data type is never used for precise values.

Example :

 float f1 =64.5f;
 float avg;

Example 1:



Output :

 Value of float variable f is :10.4

Example 2:



Output :



Double :123.43555
Character :e
Boolean :true 

Example 3:



Output :

x
y
xy
1
5
6