3 Replies Latest reply on Apr 15, 2010 7:11 AM by Kayaman


      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?