bob bob - 3 months ago 28
Java Question

Basic recursive method - factorial

I am practicing recursion and I can't see why this method does not seem to work.
Any ideas?

public void fact()

public int fact(int n)
if(n == 1){
return 1;
return n * (fact(n-1));



Your code seems to work but you are not doing anything with the returned value, put method call fact or fact(5) inside of a System.out.println and see what you get.