Hypothetical question from a fresh Groovy wanderer/learner:
If there are differences between initializing arrays as stated in official Groovy page, 3. Array initializers
In Groovy, the
{ … }block is reserved for closures. That means that you cannot create array literals with this syntax:int[] array = { 1, 2, 3}You actually have to use:
int[] array = [1,2,3]
How can we use both Java and Groovy syntax initializing array at the same class? Wouldn't compiler report errors at compile time? If not - why would it compile code?