Use of uninitialized final field - with/without 'this.' qualifier

前端 未结 4 1098
梦谈多话
梦谈多话 2020-11-29 18:45

Can someone explain to me why the first of the following two samples compiles, while the second doesn\'t? Notice the only difference is that the first one explicitly qualifi

4条回答
  •  青春惊慌失措
    2020-11-29 19:15

    I assume you refer to the behaviour in Eclipse. (As stated as comment a compile with javac works).

    I think this is an Eclipse problem. It has its own compiler, and own set of rules. One of them is that you may not access a field which is not initialized, although the Java-commpiler would initialize variables for you.

提交回复
热议问题