In what situations is static method a good practice?

后端 未结 11 1032
走了就别回头了
走了就别回头了 2020-12-04 10:04

I have read the following discussions:

Should private helper methods be static if they can be static , and
Should all methods be static if their class has no mem

11条回答
  •  失恋的感觉
    2020-12-04 11:00

    I think a definite case for static methods is when you cannot make them dynamic, because you cannot modify the class.

    This is typical for JDK objects, and also all objects coming from external libraries, and also primitive types.

提交回复
热议问题