用Java创建映射,参数错误
我目前有这段代码:
Map memory = new HashMap();
但是,它在编译时返回此错误:
GameLogic.java:5: type Map does not take parameters Map memory = new HashMap(); ^ 1 error
我不知道为什么这样做,因为我看到其他问题之后我没有理由这样做。 它属于’GameLogic’类。 请有人帮忙。
两个可能的错误:
- 您正在使用JKD 1.4
- 您导入的东西不是
java.util.Map
您可能导入了错误的Map
类。 java.util.Map
接受参数。