public class test {
static Map<String, Map<String, Integer>> mapB = new HashMap<String, Map<String, Integer>>();
static Map<String, Integer> mapA = new HashMap<String, Integer>();
public test() {
mapA.put("a", 66);
}
public static void main(String[] args) {
test t = new test();
System.out.println(mapA.get("a"));
t.tempA(mapA);
mapB.put("m", mapA);
mapA.put("a", 2);
mapA.put("b", 3);
System.out.println(mapA.get("a") + " --- " + mapA.get("b"));
System.out.println(mapB.get("m").keySet() + " ------ " + mapB.get("m"));
System.out.println(mapA.get("a") + " --- " + mapA.get("b"));
}
public void tempA(Map<String, Integer> mapC) {
mapC.put("a", 6);
}
}
运行结果:
66
2 --- 3
[a, b] ------ {a=2, b=3}
2 --- 3