In Java, is there any disadvantage to static methods on a class?

后端 未结 14 1489
无人及你
无人及你 2020-12-03 06:37

Lets assume that a rule (or rule of thumb, anyway), has been imposed in my coding environment that any method on a class that doesn\'t use, modify, or otherwise need any ins

14条回答
  •  一个人的身影
    2020-12-03 07:15

    Disadvantage -> Static

    Members are part of class and thus remain in memory till application terminates.and can't be ever garbage collected. Using excess of static members sometime predicts that you fail to design your product and trying to cop of with static /procedural programming. It denotes that object oriented design is compromised.This can result in memory over flow.

提交回复
热议问题