math.max() math.min() java code example
Example 1: java max
public class Test {
public static void main(String args[]) {
System.out.println(Math.max(12.123, 12.456));
System.out.println(Math.max(23.12, 23.0));
}
}
Example 2: math max java
// Math.max(a, b);
dataType max(dataType num1, dataType num2)
The datatypes can be int, float, double or long.
Parameters : The function accepts two parameters num1 and num2
among which the maximum is returned.