Reputation: 73
I'm trying to import another class in groovy, but to no sucess so far. I've tried to run this example:
http://www.chatsiri.com/?q=node/163
didn't work.
Caught: groovy.lang.MissingPropertyException: No such property: readData
Upvotes: 0
Views: 3718
Reputation: 4425
There is a lot of typos in the Code, and it does not follow the Convention for the java classes like (and the article is from 2007):
Anyways, just creating new classes Foo and Bar to corraborate what the blog is saying.....
File Bar.groovy
class Bar{
def print(){
println "Bar"
}
def add(a, b){
return a+b;
}
}
File Foo.groovy
def b = new Bar()
b.print()
println b.add(1,2)
Runing
>groovy Foo.groovy
Bar
3
Upvotes: 2