public void argue(ProgrammerDuck otherDuck) {
//Creates a new duck and asks what its favourite language is.
System.out.println("What is your favourite language, other duck?");
otherDuck.proclaim();
if (this.getFavProgLang().equals(otherDuck.getFavProgLang()) {
System.out.println("I agree!");
}
else {
for (int i = 0; i < 54; i++) {
this.quack();
}
In theory, this should create a new object "otherDuck" and then the real point of the method is to compare whether the "otherDuck"s variable favProgLang is the same as this.ProgrammerDucks favProgLang. I was wondering if anyone could suggest why the syntax I'm using doesn't work and if there's another method I could use that functions as I think this should.


Sign In
Create Account


Back to top









