Reputation: 1
i am having some trouble with my code, the main class has String n, int s, int d, int i
public class Maincharacter {
static Dice dice = new Dice();
private final String name;
private final int strength;
private final int dexterity;
public int intelligence;
public Maincharacter(String n, int s, int d, int i){
this.name = n;
this.strength = s;
this.dexterity = d;
this.intelligence = i;
}
and i need to make 3 extended classes getting the same attributes but has differences in them which is
public class Mage extends Maincharacter {
static Dice dice = new Dice();
private int maxMagic;
public int currentMagic;
private int heal;
public Mage(String n, int s, int d){
super (n,s,d);
this.maxMagic = 100;
this.currentMagic = maxMagic;
}
I only want to get String n, int s, and int d, but the error says that it differs in length, that i also need to add int i to it.
Sorry if there is some confusion or it may be vague but i dont know how to code that much.
Upvotes: 0
Views: 42
Reputation: 2823
you have passed
super (n,s,d);
but super class constructor asking 4 parameters, so you should pass 4 parameters into Mage class constructor
super (n,s,d,/* another parameter should pass*/);
Upvotes: 1