How can I prevent "found void but expected java.lang.String" ?
Hello people,
I wondered if anyone could be so kind as to shed some light on this probable schoolboy programming error please?
The following method is part of a program for a basic calculator and I'm wondering what I should do to correct it to avoid the above error appearing.
The getAndSetNumbers() method has been tested and successfully returns a boolean value, and the getOperator() method returns a String via a dialog box prompt (add, subtract, divide or multiply), so why doesn't the body of the if statement allocate the value of the resulting String to the variable 'operator' and how should I correct the code ?
Many thanks in advance for your help.
public void calculation()
{
if (this.getAndSetNumbers())
{
String operator = this.getOperator();
}
}