out the arithmetic necessary to compute triangular numbers this involves checking if is and adding to the results of previous recursive calls howevertriangle(also performs the operations necessary to manage the method itself these involve transfer of controlargument accessand the return address these operations are not visible by looking at the codethey're built into all methods hereroughly speakingis what happens during call to methodwhen method is calledits arguments and the return address are pushed onto stack method can access its arguments by peeking at the top of the stack when method is about to returnit peeks at the stack to obtain the return addressand then pops both this address and its arguments off the stack and discards them the stacktriangle java program contains three classesparamsstackxand stacktriangleapp the params class encapsulates the return address and the method' argumentnobjects of this class are pushed onto the stack the stackx class is similar to those in other except that it holds objects of class params the stacktriangleapp class contains four methodsmain()rectriangle()step()and the usual getint(method for numerical input the main(routine asks the user for numbercalls the rectriangle(method to calculate the triangular number corresponding to nand displays the result the rectriangle(method creates stackx object and initializes codepart to it then settles into while loop where it repeatedly calls step(it won' exit from the loop until step(returns true by reaching case its exit point the step(method is basically large switch statement in which each case corresponds to section of code in the original triangle(method listing shows the stacktriangle java program listing the stacktriangle java program /stacktriangle java /evaluates triangular numbersstack replaces recursion /to run this programc>java stacktriangleapp import java io */for / ///////////////////////////////////////////////////////////////class params /parameters to save on stack public int npublic int codepartpublic params(int nnint ran=nnreturnaddress ra/end class params ///////////////////////////////////////////////////////////////