给出“不能从静态上下文引用的非静态变量”
这是模板类的以下代码
public class BiHashMap<K1, K2, V>{
private final Map<K1, Map<K2, V>> mMap;
public BiHashMap() {
mMap = new HashMap<K1, Map<K2, V>>();
}
public V put(K1 key1, K2 key2, V value) {
Map<K2, V> map;
if (mMap.containsKey(key1)) {
map = mMap.get(key1);
} else {
map = new HashMap<K2, V>();
mMap.put(key1, map);
}
return map.put(key2, value);
}
}
public static void main(String[] args) {
BiHashMap<double,double,double> table1 = new BiHashMap<double,double,double>();
table1.put(0.375,1,350);
我尝试为 double 创建一个新课程,但错误仍然存在
public class dbble{
double number;
dbble(double x){
number=x;
}
}