2

当我尝试运行以下代码时,出现错误:

++++++++++++++++++++++++++++++++++++++++

groovy:000> 1st = [1, 2, 3]

++++++++++++++++++++++++++++++++++++++++

这是我得到的错误:

ERROR groovy.lang.MissingMethodException:
No signature of method: java.lang.Integer.call() is applicable for argument types: (java.util.ArrayList) values: [[1, 2, 3]]
Possible solutions: wait(), any(), abs(), wait(long), any(groovy.lang.Closure), and(java.lang.Number)
        at groovysh_evaluate.run (groovysh_evaluate:2)

任何想法可能是什么问题?

铁螳螂7x

4

1 回答 1

2

变量不能以数字开头。将 1st 更改为 first 足以使一切按预期工作:

 first = [1,2,3]
于 2012-12-28T15:10:05.300 回答