The result for the code below is "ex [6, 7, b, d] [6, 7, b]". Therefore I am wondering how did the exception take place and why is the value 3 missing?
import java.util.*;
public class Exam6 {
public static void main(String[] args){
TreeSet<String> t1 = new TreeSet<String>();
TreeSet<String> t2 = new TreeSet<String>();
t1.add("b");
t1.add("7");
t2 = (TreeSet)t1.subSet("5", "c");
try{
t1.add("d");
t2.add("6");
t2.add("3");
}catch(Exception e){
System.out.println("ex ");
}
System.out.println(t1 + " " + t2);
}
}
Thank You.