从HashMap中取出的对象成员怎么调用?
classstu{Stringname;Stringnum;Stringsex;intage;}classTestHarsh{publicstaticvoidmain(S...
class stu
{
String name;
String num;
String sex;
int age;
}
class TestHarsh
{
public static void main(String [] args)
{
stu a=new stu();
a.age=78;
a.name="xiaohong";
a.num="34634735746";
a.sex="男";
HashMap hm=new HashMap();
hm.put("std",a);
System.out.println(hm.get("std"));
怎样才能取出键std对应的对象成员的值? 展开
{
String name;
String num;
String sex;
int age;
}
class TestHarsh
{
public static void main(String [] args)
{
stu a=new stu();
a.age=78;
a.name="xiaohong";
a.num="34634735746";
a.sex="男";
HashMap hm=new HashMap();
hm.put("std",a);
System.out.println(hm.get("std"));
怎样才能取出键std对应的对象成员的值? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询