Problem scenario
You have a Groovy with these lines of code:
class Contint {
static void main(String[] args) {
def apple = {println “This is a basic test.”};
apple.call();
}
}
println “This is the second print statement in the code.”
The “Contint” class is never invoked. What should you do?
Solution
Overview
You need to use the “new” reserved word. This will instantiate the class.
…
Continue reading “How Do You Invoke a class in a Groovy Program?”