Java Float.valueOf(String s)
Syntax
Float.valueOf(String s) has the following syntax.
public static Float valueOf(String s) throws NumberFormatException
Example
In the following code shows how to use Float.valueOf(String s) method.
/*ww w.j a v a 2 s . co 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.