before() will not compile because there's no variable name:
Set set = new TreeSet();
With that addition, it would compile fine. SortedSet extends Set, so TreeSet indirectly implements Set, as well.
But it won't throw an exception, either -- if the exam really says that, then my advice would be to make a big fire and throw your book into it; then go get a better book. [ August 26, 2007: Message edited by: Ernest Friedman-Hill ]