We would like to know how to convert Java String to Float Object.
public class Main { //from ww w . j av a 2s. c om public static void main(String[] args) { Float fObj1 = new Float("10.64"); System.out.println(fObj1); Float fObj2 = Float.valueOf("10.76"); System.out.println(fObj2); float f = Float.parseFloat("7.39"); System.out.println(f); } }
The code above generates the following result.