When NOT to use the static keyword in Java?

后端 未结 9 847
轮回少年
轮回少年 2020-11-27 13:29

When is it considered poor practice to use the static keyword in Java on method signatures? If a method performs a function based upon some arguments, and does not require a

9条回答
  •  一整个雨季
    2020-11-27 14:07

    when you want to use a class member independently of any object of that class,it should be declared static.
    If it is declared static it can be accessed without an existing instance of an object of the class. A static member is shared by all objects of that specific class.

提交回复
热议问题