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.
你有两个选择: - 更改类的名称, - 将set的类型更改为TreeSet,如TreeSer set = new TreeSet();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.