public class Factorial {\n    public static void main(String[] args) {\n        int num = 5;\n        int factorial = 1;\n        for(int i = 1; i <= num; i++) {\n            factorial = factorial * i;\n        }\n        System.out.println("The factorial of " + num + " is: " + factorial);\n    }\n}
Create a Java program for calculating the factorial of a number?