class Stringtofloat { public static void main(String[] args) { try { String mystring = "1.4"; float myfloat = Float.parseFloat(mystring); System.out.println("Converted value from String to float is: " + myfloat); } catch (Exception e) { System.out.println(" Error " + e); } } };