Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Integer floatValue() Method in Java

  • Last Updated : 06 Jul, 2018

The java.lang.Integer.floatValue() method of Integer class of java.lang package is used to convert the value of the given Integer to a float type after a widening primitive conversion.

Syntax :

Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.

public float floatValue()

Parameters: The method does not accepts any parameter.

Return Value: The method returns the numeric value represented by this object after converting it to type float.



Below programs illustrate the java.lang.Integer.floatValue() method:
Program 1:




// Java program to demonstrate working
// of java.lang.Integer.floatValue() method
import java.lang.Integer;
  
class Gfg {
  
    // Driver code
    public static void main(String args[])
    {
        Integer a = new Integer(28);
  
        // Convert Integer number to float value
        float b = a.floatValue();
  
        System.out.println(b);
    }
}
Output:
28.0

Program 2:




// Java program to demonstrate working
// of java.lang.Integer.floatValue() method
import java.lang.Integer;
  
class Gfg {
    // Driver code
    public static void main(String args[])
    {
        Integer a = new Integer(20);
  
        // Convert Integer number to float value
        float b = a.floatValue();
  
        System.out.println(b);
    }
}
Output:
20.0



My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!