问题
I currently have this piece of code:
Map<Double, Character> memory = new HashMap<Double, Character>();
However it returns this error upon compiling:
GameLogic.java:5: type Map does not take parameters
Map<Double, Character> memory = new HashMap<Double, Character>();
^
1 error
I have no idea why its doing this as I see no reason it should after looking at other questions. It is within the 'GameLogic' class. Please could someone help.
回答1:
Two possible mistakes:
- You are using JKD 1.4
- You imported something else than
java.util.Map
回答2:
You may have imported the wrong Map
class. java.util.Map
takes parameters.
来源:https://stackoverflow.com/questions/21977204/creating-a-map-in-java-parameter-error