視頻上是對的,我寫了就錯了
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>
2016-10-04
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")都加""試試。