Thats because you declared the method (factorial) as Class method. And since main is static , methods can be called directly . Otherwise It can be accessed in non-static way , by creating instance of the class.
1) Try creating an instance of the class in the main method , call the factorial method with the instance. 2)And remove the static modifiers from the methods