package game;
public class Paizus {
public int ID;
public String name;
public Paizus(int ID, String name) {
this.ID=ID;
this.name=name;
}
}
package game;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class Sumgames{
public Map<String,Paizus>newmap;
public void Sumgame() {
this.newmap=new HashMap<String,Paizus>();
}
public void pukepai() {
Paizus paizus=new Paizus(0, "方片4");
newmap.put("0",paizus);
}
public static void main(String[] args) {
Sumgames test=new Sumgames();
test.pukepai();
}
}
id不是int类型吗,你定义了string类型吧
空指针异常