In this example we will show you how to use math.max(x,y) to return the highest value of x and y in Java.
Source Code
package com.beginner.examples;
public class Max {
public static void main(String[] args) {
System.out.println(Math.max(2, 7)); // return the highest value
}
}
Output:
7