I have to display the factorial's of numbers 1 - 20. I believe my code should work, but i keep getting the error:
FactorialTest.java:6: cannot find symbol
symbol : method factorial(int)
location: class FactorialTest
System.out.println( factorial( x ) );;
^(pointing under the "f" in "factorial")
Any help on what's causing my error, and how to fix it, would be greatly appreciated. Thank's in advance.
public class Factorial { public static long factorial(int n) { if(n<=1) return 1; else return n*factorial(n-1); } }