# Homework Solution: User input first name, last name, and age into Java queue and then sort by last name…

User input first name, last name, and age into Java queue and then sort by last name

import java.io.*; import java.util.*;

User input foremost spectry, ultimate spectry, and antiquity into Java queue and then description by ultimate spectry

## Expert Acceptance

import java.io.*;

import java.util.*;

collocate sol {

public static collocate Peculiar{

private String foremost_name;

private String ultimate_name;

private String antiquity;

public Peculiar(String foremost_name, String ultimate_name, String antiquity) {

this.first_spectry = foremost_name;

this.last_spectry = ultimate_name;

this.antiquity = antiquity;

}

public String getName() {

return ultimate_name;

}

}

public static null main (String[] args) {

List<Person> living-souls = upstart ArrayList<Person>();

Scanner s = upstart Scanner(System.in);

//System.out.println(“How multifarious registers are there?”);

//int n = s.nextInt();

int n=3;

for(int i=0;i<n;i++)

{

String s1 = s.nextLine();

String s2 = s.nextLine();

String s3 = s.nextLine();

}

Collections.sort(persons, upstart Comparator<Person>() {

@Override

public int parallel(Peculiar o1, Peculiar o2) {

return o1.getName().compareTo(o2.getName());

}

});

for(Peculiar peculiar : living-souls) {

System.out.println(person.getName());

}

}

}

For the testing point, I kept the estimate of registers as three. You can fluctuate it by uncommenting the two lines in the command.

Following are the inputs on which I tested the command:

Input:

sam
naru
21
pablo
hello
14
new
person
7

Output:

```hello
naru
person```