package collection;
import java.util.*;
public class SortedSet {
public static void main(String[] args) {
// TODO Auto-generated method stub
SortedSet set = new TreeSet();
}
}
It giving me following error:
Type mismatch: cannot convert from TreeSet to SortedSet
Your class name is also SortedSet, so it is hiding java.util.SortedSet. Either rename your class (the preferred option) or use the full name of the interface in your variable declaration.
You have two options: - change the name of class, - change type of set to TreeSet like TreeSer set = new TreeSet();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With