Float.valueOf(): This method is available in java.lang.Float class of Java.
Syntax:
Float java.lang.Float.valueOf(float f)
This method takes one argument of type float as its parameter. This method returns a Float instance representing the specified float value.
Parameters: One parameter is required for this method.
f: a float value.
Returns: a Float instance representing f.
For Example:
float f = 188.7f
Float.valueOf(f) = > It returns 188.7
Approach
Java
public class FloatValueofFloat {public static void main(String[] args) {float f = 188.7f;System.out.println(Float.valueOf(f));}}
Output:
188.7
No comments:
Post a Comment