I have to create an application which calculates postfix expressions. I was able to find it online (rosetta code) but it's missing a unary operator. the symbol "~" is supposed to denote the unary operator I tried adding it but unfortunately it didn't work. Please advise;
else if(token.equals("~")){
System.out.print("Operate\t\t");
double firstOperand = stack.pop();
stack.push(firstOperand * -1);
}else