string br readline()return ///end class bracketsapp the check(routine makes use of the stackx class from the last program notice how easy it is to reuse this class all the code you need is in one place this is one of the payoffs for object-oriented programming the main(routine in the bracketsapp class repeatedly reads line of text from the usercreates bracketchecker object with this text string as an argumentand then calls the check(method for this bracketchecker object if it finds any errorsthe check(method displays themotherwisethe syntax of the delimiters is correct if it canthe check(method reports the character number where it discovered the error (starting at on the left)and the incorrect character it found there for examplefor the input string { ( ] } the output from check(will be errorat the stack as conceptual aid notice how convenient the stack is in the brackets java program you could have set up an array to do what the stack doesbut you would have had to worry about keeping track of an index to the most recently added characteras well as other bookkeeping tasks the stack is conceptually easier to use by providing limited access to its contentsusing the push(and pop(methodsthe stack has made your program easier to understand and less error prone (carpenters will also tell you it' safer to use the right tool for the job efficiency of stacks items can be both pushed and popped from the stack implemented in the stackx class in constant ( time that isthe time is not dependent on how many items are in the stackand is therefore very quick no comparisons or moves are necessary queues the word queue is british for line (the kind you wait inin britainto "queue upmeans to get in line in computer science queue is data structure that is similar to stackexcept that in queue the first item inserted is the first to be removed (fifo)while in stackas we've seenthe last item inserted is the first to be removed (lifoa queue works like the line at the moviesthe first person to join the rear of the line is the first person to reach the front of the line and buy ticket the last person to line up is the last person to buy ticket (or--if the show is sold out--to fail to buy ticketfigure shows how this looks