What will be the result of compilation and execution of the following code:
public class Test {
static int fact(int x) {
if (x == (-2))
return -2;
return (fact(x-1) * x);
}
public static void main(String[] args) {
System.out.println(Test.fact(2));
}
}
Login in to like
Login in to comment