Inside getNum , you're directly invoking the getNum function, causing the stack to exhaust. Replace the ...
stackoverflow.com