I am learning Java using the book Java: The Complete Reference. Currently I am working on the topic Recursion.
Please Note: There are similar questi
public class Factorial { public static void main(String[] args) { System.out.println(factorial(4)); } private static long factorial(int i) { if(i<0) throw new IllegalArgumentException("x must be >= 0"); return i==0||i==1? 1:i*factorial(i-1); } }