java - Stack overflow with tail recursion -


why getting stack overflow exception? isn't meant tail recursive function?

public static int tailfact(int n, int mult) {     if(n == 0) {         return mult;     }else {         return tailfact(n-1, n*mult);     } }  public static int factt(int n) {     return tailfact(n, 1); }  public static void main(string[] args) {                         factt(100000); }   /*exception in thread "main" java.lang.stackoverflowerror    @ test3.test.tailfact(test.java:13)   @ test3.test.tailfact(test.java:13)   ... */ 

java doesn't support tail recursion.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -