import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class clsWarehouse {
public static void main(String[] args){
class Items {
private String iItemID;
private String strItemName;
private String strItemDescription;
private String iItemPrice;
private String strSize;
private String strSex;
public Items (String id, String name, String description, String price, String size, String sex){
iItemID = id;
strItemName = name;
strItemDescription = description;
iItemPrice = price;
strSize = size;
strSex = sex;
}
}
Map<Integer, Items> ItemMap = new HashMap<Integer, Items>();
ItemMap.put(1, new Items("3", "test1", "test2", "30", "20", "Male"));
for (Map.Entry<Integer, Items> entry : ItemMap.entrySet()) {
System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());
Items test = entry.getValue();
String test2 = test.toString();
System.out.println(test2);
}
}
}
你好,
我想获取存储在地图中的值,但我只获取内存位置,Key = 1,Value = clsWarehouse$1Items@c3c749。有人可以帮我弄这个吗。
谢谢!