Choose all that apply:
A) Compiles with warning
B) A runtime exception occurs
C) Compiles without warning
D) Only one test object is added, Other one is considered duplicate
E) TreeSet can only accept objects of type test.
Answer is : B,C & E
my question is why will there be a runtime exception.
TreeSet collection object created with default constructor takes elements that implement Comparable interface only.
When the code tries to insert elements that violate this constraint, ClassCastException will be thrown.