With the help of Float.parseFloat() method, you can convert String to float in Java.
Following is the example that will show conversion from String to float-
public class Example { public static void main(String args[]) { String b = "3.14"; float a = Float.parseFloat(b); System.out.println(a); } }
Output
3.14