Anonymous-Inner classes showing incorrect modifier

前端 未结 4 1925
半阙折子戏
半阙折子戏 2020-11-30 11:10

To my understanding, the following code should have printed true as output.

However, when I ran this code it is printing false.

Fro

4条回答
  •  温柔的废话
    2020-11-30 11:21

    An anonymous class is never final (§8.1.1.2).

    JLS 11 - 15.9.5. Anonymous Class Declarations

    I didn't know the reasoning behind this, but, according to @Hulk's answer and this bug report, it seems the specification of previous versions slightly misled us saying that anonymous classes are final.

提交回复
热议问题