I run the following
Choice choice1 = new Choice(0); Choice choice2 = new Choice(1); int result = choice1.compareWith(choice2); IO.outputln("Actual: " + result); the compareWith method
public int compareWith(Choice anotherChoice) { int result=0; if (anotherChoice==0||type==0) result=1; if (anotherChoice==1&&type==1) result=-11; } The program said that i can not compare anotherchoice (choice class) with a integer. How can I do it.
Choice. I assume you want to compare instance variabletype. So it should beanotherChoice.type == this.type