Java Help!
A stack is useful in the analysis of expressions to check if there are unbalanced symbols, because we know that when finding a closing symbol like), it must correspond to the opening symbol (more recent that is not yet closed.) Java programming and the data structure stack, implement the following algorithm: 1. create an empty stack. 2. read the symbols until the end of the file a) If the syntactic element is an opening symbol, insert it into the. stack. b) If it is a closing symbol and the pilá is empty, inform that an. error has occurred. c) Otherwise, remove an element from the stack, If the extracted symbol is not the corresponding opening symbol, report an error. 3. At the end of the file, if the stack is not empty, report an error.