3 Replies Latest reply: Apr 15, 2010 2:11 AM by Kayaman RSS


      TreeSet<String> s = new TreeSet<String>();
                TreeSet<String> subs = new TreeSet<String>();
                 s.add("a"); s.add("b"); s.add("c"); s.add("d"); s.add("e");
                 subs = (TreeSet) s.subSet("b",true, "d",true);  //1
                 System.out.println(s +" "+ subs);
      in line 1 it returns navigableSet but it is casted to treeset which is a subclass of navigableset so
      why doesn't it returns classcastexception?