I know curly brackets are not used to initialize array in Groovy but I have noticed one peculiar thing.
Why groovy doesn't give compiler error when I initialize an array like this.
String emailAddress = "[email protected]";
String [] var = {emailAddress};
println var[0];
Output: com.test.examples.GroovyTest$_main_closure1@12e4860e
When I try to declare like this I get error:
String [] var = {"a","b"};
Can anybody explain this?