Why can't we set the value of static final variable in static block through class name [duplicate]
问题 This question already has answers here : Why isn't a qualified static final variable allowed in a static initialization block? (2 answers) Closed 4 years ago . For example, consider code snap below: public static final int a; public static final int b; static { a = 8; // it's working Test.b = 10; // compilation error Test.b cannot be assigned. } Why can't we use Test.b = 10; inside a static block of the Test class itself? Without the class name it's working fine. Is there any reason behind