Given the String variables name1and name2, write a fragment of code that assigns the larger of the two to the variable first (assume that all three are already declared and that name1 and name2 have been assigned values ). (NOTE: “larger ” here means alphabetically larger, not “longer”. Thus, “mouse” is larger than “elephant” because “mouse” comes later in the dictionary than “elephant”!)

Given the String variables name1and name2, write a fragment of code that assigns the larger of the two to the variable first (assume that all three are already declared and that name1 and name2 have been assigned values ). (NOTE: “larger ” here means alphabetically larger, not “longer”. Thus, “mouse” is larger than “elephant” because “mouse” comes later in the dictionary than “elephant”!)

LANGUAGE: JAVA

CHALLENGE:

Given the String variables name1and name2, write a fragment of code that assigns the larger of the two to the variable first (assume that all three are already declared and that name1 and name2 have been assigned values ). (NOTE: “larger ” here means alphabetically larger, not “longer”. Thus, “mouse” is larger than “elephant” because “mouse” comes later in the dictionary than “elephant”!)

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days – Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level