我刚从groovy开始。此错误看起来很基本。但我似乎没有通过这个。感谢任何指导我走向正确方向的帮助
我定义了一个如下所示的字符串并将其传递给testSender方法
def line = "5 1 -81.42 Ido1"
testSender(line.toString())
testSender方法的定义
def testSender(line){
try {
println line
} catch(e) {
println e.printStackTrace()
}
}
当我运行此操作时,出现此错误
groovy.lang.MissingMethodException:
No signature of method: GroovySQLQuery$_main_closure1.testSender()
is applicable for argument types: (java.lang.String) values: [5 1 -81.42 Ido1]
答案 0 :(得分:2)
应该是:
class GroovySQLQuery {
static void main(String[] args) {
def line = "5 1 -81.42 Ido1"
testSender(line.toString())
}
static testSender(line) {
println line
}
}