so I have a base class where I define an enum variable with this block of code.
enum Faction {
AMITY, ABNIGATION, DAUNTLESS, EURIDITE, CANDOR
};
And I'm trying to test to see if everything in my subclass works by using a driver. My constructor in my subclass looks like this.
public Dauntless(String f, String l, int a, int ag, int end, Faction d) {
super(f, l, a, d);
if (ag >= 0 && ag <= 10) {
this.agility = ag;
} else {
this.agility = 0;
}
if (end >= 0 && end <= 10) {
this.endurance = end;
} else {
this.endurance = 0;
}
}
And my driver looks like this
public class Test {
public static void main(String[] args) {
Faction this = Faction.DAUNTLESS;
Dauntless joe = new Dauntless("Joseph", "Hooper", 20, 5, 3, this);
Dauntless vik = new Dauntless("Victoria", "Ward", 19, 6, 2, this);
Dauntless winner;
winner = joe.battle(vik);
System.out.println(winner);
}
It keeps saying that Faction this = Faction.DAUNTLESS;
is not a statement. Can somebody help me out here?
Aucun commentaire:
Enregistrer un commentaire