关于Hashtable的问题,up有分
大家看看这段jsp代码是不是有问题?为什么我书读到页面的两个Hashtable的大小一样呢?
<%@page import="java.util.*"%>
<%
Hashtable test1 = new Hashtable();
Hashtable all = new Hashtable();
test1.put("A","第一列");
test1.put("B","第二列");
all.put("FIRST",test1);
test1.clear();
test1.put("1","No1");
test1.put("2","No2");
test1.put("3","No3");
all.put("SECOND",test1);
out.println("all.size = "+all.size()+"<br>");
Hashtable check = (Hashtable)all.get("FIRST");
out.println("first.size = "+check.size()+"<br>");
Hashtable check1 = (Hashtable)all.get("SECOND");
out.println("second.size = "+check1.size()+"<br>");
%>
运行结果如下:
all.size = 2
first.size = 3
second.size = 3
但我觉得应该是
all.size = 2
first.size = 2 //应该是2才对
second.size = 3
请各位高手指点,