How to convert String to primitive float in Java

1 Answer

0 votes
package javaapplication1;

public class JavaApplication1 {
 
    public static void main(String[] args) {
  
        String s = "3.14";
        
        float f = Float.parseFloat(s);
        System.out.println(f);
    }
}
 
/*
    
run:

3.14

*/

 



answered Nov 4, 2016 by avibootz

Related questions

1 answer 236 views
1 answer 321 views
1 answer 283 views
1 answer 243 views
2 answers 320 views
1 answer 309 views
...