Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我将我的字符串声明为Set<String> one;.
Set<String> one;
然后我说one = "string";
one = "string";
得到错误Type mismatch: cannot convert from String to Set<String>。
Type mismatch: cannot convert from String to Set<String>
任何的想法?
一组字符串不是字符串。
也许你想要这个方法Set.add()?
Set.add()
添加对象以像这样设置....
Set<String>one=new HashSet<String>(); one.add("string");