☞A function designed in such a way that it calls itself in its body is called a recursive function.
class Recursive{
int fact(int n){
if(n==0)
return 1;
else
return(n*fact(n-1));
}
public static void main(String args[]){
Recursive obj=new Recursive();
int k=5,f;
f=obj.fact(k);
System.out.println(f);
}
}
120