Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started