Java Language Specification - Cannot understand 'BlockStatement'

前端 未结 5 1664
梦如初夏
梦如初夏 2021-02-20 00:06

I\'ve been examining the Java Language Specification here (instead I should be out having a beer) and I am curious about what a method can contain. The specification states a me

5条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-20 01:03

    These are called local classes. I use it occasionally, but it's not really a necessity.

    Edit: a local class can be static, if it appears in a static context, for example, within a static method.

    From the wording of the spec, local/inner/anno classe always means class only, not interface.

提交回复
热议问题