firstLast.java
import java.util.*;
public class firstLast {
public static void main(String[] args) {
TreeSet tree = new TreeSet();
tree.add(15);
tree.add(25);
System.out.println("First is "+tree.first()+" and 2nd is
"+tree.last());
}
}
Output
First is 15 and 2nd is 25