Output:Code:`// A simple example of recursion.`

class Factorial {

// this is a recursive method

int fact(int n) {

int result;

if(n==1) return 1;

result = fact(n-1) * n;

return result;

}

}

class Recursion {

public static void main(String args[]) {

Factorial f = new Factorial();

System.out.println("Factorial of 3 is " + f.fact(3));

System.out.println("Factorial of 4 is " + f.fact(4));

System.out.println("Factorial of 5 is " + f.fact(5));

}

The book calls it a recursion/recursive the process of defining something in terms of itself.Code:`Factorial of 3 is 6`

Factorial of 4 is 24

Factorial of 5 is 120

But i can't understand this recursion and i want to learn it because it will be vital in my programming skills.

Can someone explain to me what's going on to this code?