我正在尝试运行此代码:
import java.util.*;
public class ScanReg {
public Map<Integer, ArrayList<Long>> scanMap = new HashMap<Integer, ArrayList<Long>>();
}
在这个类中:
import java.util.*;
public class NxtStart {
ScanReg sr = new ScanReg();
}
这不断给我以下错误:
.\ScanReg.java:6: error: cannot find symbol
public Map<Integer, ArrayList<Long>> scanMap = new HashMap<Integer, Arra
yList<Long>>();
^
symbol: class Map
location: class ScanReg
.\ScanReg.java:6: error: cannot find symbol
public Map<Integer, ArrayList<Long>> scanMap = new HashMap<Integer, Arra
yList<Long>>();
^
symbol: class HashMap
location: class ScanReg
2 errors
有人可以告诉我为什么吗?
最佳答案
您可能正在使用 Java 1.4 进行编译并使用泛型(仅从 1.5 开始可用)。
关于Java:在 Map、HashMap 上找不到符号错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7863727/