Accessing Java static final variable value through reflection

前端 未结 4 1921
轮回少年
轮回少年 2020-11-27 18:13

Can the value of a Java static final class variable be retrieved through reflection?

4条回答
  •  -上瘾入骨i
    2020-11-27 18:55

    Yes. (Only there is no such thing as static, instance. It's static, non-instance.)

    > If the underlying field is a static field, the obj argument is ignored; it may be null.

    (include standard warning that most uses of reflection are a bad idea)

提交回复
热议问题