这个是个VO对像
[quote="java"]
package com.lihui.VO;
public class AddListVO {
private int goodId;
private int buyNum;
private int orderId;
public AddListVO() {
super();
// TODO Auto-generated constructor stub
}
public AddListVO(int goodId, int buyNum, int orderId) {
super();
this.goodId = goodId;
this.buyNum = buyNum;
this.orderId = orderId;
}
public int getGoodId() {
return goodId;
}
public void setGoodId(int goodId) {
this.goodId = goodId;
}
public int getBuyNum() {
return buyNum;
}
public void setBuyNum(int buyNum) {
this.buyNum = buyNum;
}
public int getOrderId() {
return orderId;
}
public void setOrderId(int orderId) {
this.orderId = orderId;
}
}
[/quote]
然后是主方法:
[quote="java"]
public class map {
private AddListVO addListVO;
public static void main(String args[])
{
AddListVO listVO=new AddListVO(1, 2, 3);
HashMap hashmap = new HashMap();
hashmap.put("Item0", listVO);
hashmap.put("Item1", listVO);
hashmap.put("Item2", listVO);
hashmap.put("Item3", listVO);
Set set = hashmap.entrySet();
Iterator iterator = set.iterator();
while (iterator.hasNext()){
Map.Entry mapentry = (Map.Entry) iterator.next();
System.out.println(mapentry.getKey() + "/" + mapentry.getValue());
}
}
public AddListVO getAddListVO() {
return addListVO;
}
public void setAddListVO(AddListVO addListVO) {
this.addListVO = addListVO;
}
}
[/quote]
我得到的是
Item1/com.lihui.VO.AddListVO@c17164
Item2/com.lihui.VO.AddListVO@c17164
Item0/com.lihui.VO.AddListVO@c17164
Item3/com.lihui.VO.AddListVO@c17164
我想得到这个对象里的元素的值 应该咋办?