/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
import java.util.*;
public class Main
{
public static void main(String[] args) {
//children children=new children();
List<children> ch=new ArrayList<children>();
ch.add(new children("x","y",3));
ch.add(new children("a","b",13));
ch.add(new children("c","y",7));
ch.add(new children("b","d",2));
ch.sort(Comparator.comparing(children::getAge));
for(children c:ch){
System.out.println(c.getFName()+" "+c.getLName()+" "+c.getAge());
}
}
public static class children
{
private String fname;
private String lname;
private int age;
public children(String fname,String lname,int age){
this.fname=fname;
this.lname=lname;
this.age=age;
}
public String getFName(){
return fname;
}
public String getLName(){
return lname;
}
public int getAge(){
return age;
}
}
}