Limited access

Upgrade to access all content for this subject

Consider the following method.

public static String compareStrings(String a, String b)
{
    if (a.compareTo(b) > 0)
        return b + ", " + a;
    else
    if (a.compareTo(b)< 0)
        return a + ", " + b;
    else
        return a ;
}

What would the following section of code print to the console?

System.out.print(compareStrings("no touchdowns", "1 touchdown") + ", " +
     compareStrings("field" , "field goal") + ", " +
     compareStrings("tackle", "Tackle"));
A
no touchdowns, 1 touchdown, field, field goal, tackle, Tackle
B
1 touchdown, Tackle, field, field goal, no touchdowns, tackle
C
1 touchdown, no touchdowns, field, field goal, Tackle, tackle
D
no touchdowns, 1 touchdown, field goal, field, tackle, Tackle
E
1 touchdown, no touchdowns, field, field goal, tackle
Select an assignment template