Write a method max that has two string parameters and returns the larger of the two.

LANGUAGE: Java

CHALLENGE:

Write a method max that has two string parameters and returns the larger of the two.

SOLUTION:

public String max (String x, String y)
{
    String max;
    if (x.compareTo(y)>0)
    {
        max=x;
    }
    else
    {
        max=y;
    }
    
    return max;
}