Static and non static fields

前端 未结 6 883
有刺的猬
有刺的猬 2020-12-04 00:36

just to clarify I am thinking of this right, in java a static field is a variable/field which is used by a whole class, or can be used by all objects refering to that class?

6条回答
  •  一生所求
    2020-12-04 01:10

    Kind of... a static object is shared between instances of a class and a non-static is specific to the instance. Same goes for methods.

提交回复
热议问题