Java compiler allows accessing uninitialized blank final field using 'this' keyword? Is this a bug? [duplicate]
问题 This question already has answers here : Use of uninitialized final field - with/without 'this.' qualifier (4 answers) Closed 5 years ago . I wrote this piece of code and it seems compiler allows accessing uninitialized blank final field when accessed using 'this' keyword: public class TestClass { public final int value1; public int value2; TestClass(int value) { value2 = 2 + this.value1; // access final field using 'this' before initialization gives no compiler error //value2 = 2 + value1; /