while (strToken.hasMoreTokens())
{
String i = strToken.nextToken();
char ch = ' ';
ch = i.charAt(0);
int operand;
int operator;
if(Character.isDigit(ch))
{
operand = Integer.parseInt(i);
operandStack.push(operand);
}
else
{
operator = i.charAt(0);
operatorStack.push(operator);
}
}
while(operandStack.size() > 1)
{
operandStack.push(operate(operandStack.pop(),
operandStack.pop(), operatorStack.pop()));
}
resultTextField.setText(Integer.toString(operandStack.peek()));
My code does not evaluate operands in prefix notation. How should I revise it to evaluate operands in prefix notation.