When to use static methods

前端 未结 21 1846
旧巷少年郎
旧巷少年郎 2020-11-21 05:05

I am wondering when to use static methods? Say if I have a class with a few getters and setters, a method or two, and I want those methods only to be invokable on an instanc

21条回答
  •  一向
    一向 (楼主)
    2020-11-21 05:22

    Use a static method when you want to be able to access the method without an instance of the class.

提交回复
热议问题