我不知道该怎么做,这是我尝试过的:
public class Mage{
private int hp;
private int mp;
private String type;
private String weakness;
private int numSpell;//the input will tell you how long the array will be
public Mage(int ihp, int imp, String itype, String iweakness, int inumSpell, String[] ispells){
hp=ihp;
mp=imp;
type=itype;
weakness=iweakness;
private String[] spells = new String[inumSpell];
for(int i=0;i<ispells.length;i++){
spells[i]=ispells[i];
}
}
}
你会认为我的猜测是正确的吗?任何帮助将不胜感激,谢谢。