Groovy Hello World program
Consider we want to print a simple string “Hello World” in Java. The code to achieve the string Groovy hello world would be:
public class Demo { public static void main(String[] args) { System.out.println("Hello World"); } }
The above code is valid in both Java and Groovy as Groovy is a superset of Java. But the advantage with Groovy is that we can do away with class creation, public method creation, etc and achieve the same output with a single line code as follows:
println "Hello World."