The max()  method of Integer class returns the greater of two int values. It returns the same result as by calling Math.max.


public static int max(int a, int b)


The parameters ‘a’ and ‘b’ represent the first and second operand.

 Return Value

This method returns the greater of ‘a’ and ‘b’.

Example 1


Example 2


Example 3


Pin It on Pinterest

Share This