命令行和groovyConsole上的groovy错误

时间:2012-12-28 15:07:21

标签: java groovy

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

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

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)

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

ironmantis7x

1 个答案:

答案 0 :(得分:2)

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

 first = [1,2,3]