Float.valueOf(String s) has the following syntax.
public static Float valueOf(String s) throws NumberFormatException
In the following code shows how to use Float.valueOf(String s) method.
//from w ww . j a v a 2 s. c o m public class Main { public static void main(String[] args) { String str = "0.56"; System.out.println("Value = " + Float.valueOf(str)); } }
The code above generates the following result.