int a = 5; int b = 7; int maxNum = Math.max(a, b); System.out.println(maxNum); // Output: 7
double c = 8.5; double d = 6.9; double maxDouble = Math.max(c, d); System.out.println(maxDouble); // Output: 8.5In this example, the Math.max method is used to find the maximum between two double values, c and d. The java.util package library provides a set of classes that allows the programmer to easily perform common tasks, such as working with date and time, manipulating strings, or performing mathematical operations. The Math class belongs to the java.util package/library.