Why Have Private Static Methods?

access-modifiersclassmethodsobject-orientedstatic methods

I just wanted to clear up a question I have. What is the point of having a private static method as opposed to a normal method with private visibility?

I would have thought an advantage to having a static method is that it can be called without an instance of a class, but since its private is there even a point to it being static?

The only reason I can think of is that it helps conceptually understanding the method on the class level as opposed to object level.

Best Answer

The characteristic of being static is independent of the visibility.

The reasons that you will want to have a static method (some code that does not depend on non-static members) will still be useful. But maybe you don't want anyone/anything else to use it, just your class.