When to use static methods

前端 未结 21 1924
旧巷少年郎
旧巷少年郎 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:33

    Static methods are the methods in Java that can be called without creating an object of class. It is belong to the class.

    We use static method when we no need to be invoked method using instance.

提交回复
热议问题