そのようなことを行う方法がわかりません。私が試したことは次のとおりです。
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];
}
}
}
私の推測は正しいと思いますか?どんな助けでも大歓迎です、ありがとう。