Question: Give the Java SE program below: import java.util. * ; class Name { private String first , last; Name ( String f , String l
Give the Java SE program below:
import java.util.;
class Name
private String first last;
NameString f String lfirst f; lastl;
Name
@Override public String toString return first last;
public static int compareByLastNameName n Name n
return nlast.compareTonlast;
public class MethodRefTest
public static void mainString args
Name n new NameHarryHomeowner;
Name nnew NamePaulPainter;
Name nnew NameJaneDoe;
List nameListArrays.asListnnn;
Which of the following lines of code correctly substitute to cause the program to compile and generate the output?
Jane Joe
Harry Homeowner
Paul Painter
a nameList.sortn::compareByLastName;
nameList.forEachSystemout::println;
b nameList.sortName::compareByLastName;
nameList.forEachSystemout::println;
c nameList.sortName::compareByLastName;
nameList.forEachSystemout::println;
d nameList.sortName::compareByLastName;
nameList.forEachSystemout.println;
e nameList.sortName::compareByLastName;
nameList.forEachSystemout.println;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
