Field xxx is never assigned to, and will always have its default value null

前端 未结 4 1274
南方客
南方客 2020-12-17 18:26

Anyone know whats this problem?

I got this warning Field xxx is never assigned to, and will always have its default value null on private sta

4条回答
  •  有刺的猬
    2020-12-17 19:21

    Static members are accessed via the type name, i.e.

    Quantization.quantit = {some value};
    

    Of course since it is private you would have to so this from inside the type, in which case you can just use:

    quantit = {some value};
    

    However, I would also question whether static is an appropriate option here, especially if you are doing any threading (or web code). Static is often overused (and used inappropriately).

提交回复
热议问题