Float.max(): This method is available in java.lang.Float class of Java.
Syntax:
float java.lang.Float.max(float a, float b)
This method takes two arguments of type float as its parameters. This method returns the greater of two float values.
Parameters: Two parameters are required for this method.
a: the first operand.
b: the second operand.
Returns: the greater of a and b.
For Example:
float a = 1991.5f, b = 1991.119f
Float.max(a,b) = > It returns 1991.5
Approach
Java
public class FloatMax {public static void main(String[] args) {float a = 1991.5f, b = 1991.119f;System.out.println(Float.max(a, b));}}
Output:
1991.5
No comments:
Post a Comment