举例来说,我有一个这样的类:如何调用groovy中另一个类的方法?
class firstOne{
....
def A(){
}
}
class secondOne{
// I need to call and use method A from class firstOne
// even I get error if I try to follow Java like calls
// firstOne method = new firstOne();
// method.A()
}
我已经尝试过http://groovy.codehaus.org/Scripts+and+Classes和http://groovy.codehaus.org/Groovy+Beans,但没有办法。任何类型的建议或例子都会非常有帮助。
这是什么都使用Grails呢?此外,大写字母的方法是最好的避免 –
你得到什么错误? – toniedzwiedz
您的语句需要位于代码块中,而不是类块 – Reimeus