Well, it looks like it is not possible. But how can i evaluate a postfix expression without having an operator in the stack of numbers?
Ok: I’ll try again.
I want to build a basic calculator. The user will write input numbers. I want to add these into a stack (list), and when the user hits/writes execute the program should evaluate it in postfix manner.
Create a base class of ExpressionToken and have NumberToken and OperatorToken extend it. Parameterize the ArrayList as a list of ExpressionTokens.