【发布时间】:2011-10-23 01:15:36
【问题描述】:
我正在尝试运行此代码:
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.util的本地包吗?我会尝试导入整个类名:import java.util.Map;,对于使用的其他 util 类(例如 HashMap)也是如此。 -
Kal 可能正在做某事(对他来说是 1+!)。
-
我无法根据问题中的信息重新创建它。其他事情正在发生。而且由于 OP 很可能不再关心,因此应该将其关闭为“不可重现”。
标签: java missing-symbols