问答详情
源自:4-1 获取所有学生数据

视频上是对的,我写了就错了

public Student(Map

map){ this.id = (int)map.get("id"); this.stuName = (String)map.get(stuName); this.age = (int)map.get("age"); this.gender = (int)map.get("gender"); this.address = (String)map.get(address); } Cannot cast from Object to int不知道怎么调试,object>

提问者:zcs1818918 2016-09-30 12:00

个回答

  • 小羊杨
    2016-10-04 09:01:07

    this.id = (int)map.get("id"); this.stuName = (String)map.get(stuName)前面id加了“”为啥后面的都不加 。this.id = (int)map.get("id"); this.stuName = (String)map.get("stuName")都加""试试。