[英]Why does my code say it can't find the . symbol?
HashMap <String, Integer> output = new HashMap <String, Integer> ();
for (int j = 0 ; j < np; j++) {
output.add(people, recived1);
System.out.println(output);
当我编译它说的代码时:
error: cannot find symbol
output.add(people, recived1);
^
我假设您在这里使用 Java。 Java Map接口没有add
方法。 而是使用put(key, value)
方法将数据添加到 map。
通常,当编译器说cannot find symbol
时,它指向您错误地使用 API。 这可能是拼写错误或误解。 使用 API 文档来提供帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.