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”!)

Java

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…

Read More