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

 Syntax

public static int max(int a, int b)

Parameters

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

 Return Value

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

Example 1

 Output

Example 2

Output

Example 3

Output

Pin It on Pinterest

Share This