Create, Compile and Run the Hello World Program in Apache Groovy
Groovy programs can be written in a very easy manner, follow the below two steps to create, compile and run the program.
1. Open a text editor, write the following "Hello World" program and save the file with .groovy extension i.e. HelloWorld.groovy
Note: The file name should be the same as the class name with extension .groovy - for example, if the class name is HelloWorld then the file name should be HelloWorld.groovy
Hello World Program - HelloWorld.groovy
class HelloWorld {
public static void main(String[] args) {
println("Hello World");
}
}
2. Compile and run the groovy file (i.e. groovy program) using the command groovy HelloWorld.groovy.