listing recursion continued public boolean isempty(/true if stack is empty return (top =- )///end class stackx ///////////////////////////////////////////////////////////////class stacktriangle app static int thenumberstatic int theanswerstatic stackx thestackpublic static void main(string[argsthrows ioexception system out print("enter number")thenumber getint()stacktriangle()system out println("triangle="+theanswer)/end main(//public static void stacktriangle(thestack new stackx( )/make stack theanswer /initialize answer while(thenumber /until is thestack push(thenumber)/push value --thenumber/decrement value while!thestack isempty(/until stack emptyint newn thestack pop()/pop valuetheanswer +newn/add to answer //public static string getstring(throws ioexception inputstreamreader isr new inputstreamreader(system in)bufferedreader br new bufferedreader(isr)