Convert String to Float in Java

In Java, we can easily convert string to float using Float.parseFloat() function.If you give a float element to the input.It will print the float element.Suppose if you given an Integer number,It will finally add point zero.

Source code :

public class Example{
    public static void main(String args[]){  

    float floatNumber = Float.parseFloat("25");
    System.out.println(floatNumber);
    }
}

Output :

25.0

Output :


                

Comments :