Valid Java code that is NOT valid Groovy code?

后端 未结 8 2088
忘了有多久
忘了有多久 2020-12-05 04:50

Most Java code is also syntactically valid Groovy code. However, there are a few exceptions which leads me to my question:

Which constructs/features in Java are syn

8条回答
  •  误落风尘
    2020-12-05 05:28

    Multidimensional arrays, where size is not specified.

    def x=new Object[5][];  // ERROR: expression expected 
    
    def x=new Object[5][2]; // this works
    

提交回复
热议问题