parseFloat() Method in java

Java Programming Language Number Class in java (Article) Number Class in java (Program)

1143

Program:


 public class ParseFloat {

   public static void main(String args[]) {

      float x =Float.parseFloat("9.9");

      System.out.println(x);

   }
}

/*

This method is used to get the primitive data type of a certain String.
parseFloat(String s) - This returns an float (decimal only).
s - This is a string representation of decimal.

*/

Output:

9.9
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.