search

Home  >  Q&A  >  body text

java类包括成员变量和成员方法,那常量呢?常量也属于成员变量?

高洛峰高洛峰2815 days ago894

reply all(2)I'll reply

  • ringa_lee

    ringa_lee2017-04-18 10:46:58

    • Member xx corresponds to class xx. For example, member variables and class variables are non-statically modified and statically modified in a class.

    • Constants can be divided into member constants and class constants, just check whether there is static modification

    reply
    0
  • 黄舟

    黄舟2017-04-18 10:46:58

    There is a definition of final Variables in the Java language specification, and only final修饰的变量应该就叫做final变量 is used in examples.

    staticfinalIt is called a constant if it is modified at the same time.
    The Java specification is defined as follows

    static variables that are final and that are initialized with compile-time constant values ​​are initialized first. This also applies to such fields in interfaces (§9.3.1). These variables are "constants"

    reply
    0
  • Cancelreply