fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. String strtest="3.5";
  13.  
  14. float f2 = Float.valueOf(strtest);
  15. float f1 = Float.parseFloat(strtest);
  16.  
  17. System.out.println("f1:" + f1+" f2:"+f2); }
  18. }
Success #stdin #stdout 0.05s 711168KB
stdin
Standard input is empty
stdout
f1:3.5   f2:3.5