Java String to float

We can convert String to float in java using Float.parseFloat() method.

Scenario

It is generally used if we have to perform mathematical operations on the string that contains float number. Whenever we get data from textfield or textarea, entered data is received as a string. If entered data is float, we need to convert string to float. To do so, we use Float.parseFloat() method.

Signature

public static int parseFloat(String s)

EXAMPLE

Flash Soon



Advertisement

© Sapster 2017