When I try to run and compile my code, the console shows:
 Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
    at FactorialProgram5.main(FactorialProgram5.java:9)
I can't figure out why it is doing that as the other codes that I did are working.
Here is my code:
import java.util.Scanner;
public class FactorialProgram5 {
    public static void main(String args[]) {
        long n;
        long fact = 1;
        n = Long.parseLong(args[0]);
        for (int i = 1; i <= n; i++) {
            fact = fact * i;
        }
        System.out.print("fact=" + fact);
    }
}
 
     
    