Java Language Specification - Cannot understand 'BlockStatement'

前端 未结 5 1655
梦如初夏
梦如初夏 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:05

    An example for a block with an inner class declaration:

    public class Test {
    
        static 
        {
            class C {}
            C c = new C();
        }
    }
    

    Although I doubt you'll find a use case...

提交回复
热议问题