public static void main(string[argsthrows ioexception string inputint outputwhile(truesystem out print("enter postfix")system out flush()input getstring()/read string from kbd ifinput equals(""/quit if [enterbreak/make parser parsepost aparser new parsepost(input)output aparser doparse()/do the evaluation system out println("evaluates to output)/end while /end main(//public static string getstring(throws ioexception inputstreamreader isr new inputstreamreader(system in)bufferedreader br new bufferedreader(isr)string br readline()return ///end class postfixapp the main(method in the postfixapp class gets the postfix string from the user and then creates parsepost objectinitialized with this string it then calls the doparse(method of parsepost to carry out the evaluation the doparse(method reads through the input stringcharacter by character if the character is digitit' pushed onto the stack if it' an operatorit' applied immediately to the two operators on the top of the stack (these operators are guaranteed to be on the stack alreadybecause the input string is in postfix notation the result of the arithmetic operation is pushed onto the stack once the last character (which must be an operatoris read and appliedthe stack contains only one itemwhich is the answer to the entire expression here' some interaction with more complex inputthe postfix expression +* +/-which we showed human evaluating in figure this corresponds to the infix *( + )- /( + (we saw an equivalent translation using letters instead of numbers in the last sectiona*( + )- /( +fin infix is abc+*def+/in postfix here' how the postfix is evaluated by the postfix java program