Sunday 13 January 2019

Groovy: HelloWorld Application


Create a file HelloWorld.groovy with below content.

HelloWorld.groovy
println "Hello World"
println "Welcome to Groovy programming"

Open terminal and execute 'groovy HelloWorld.groovy', you can see below messages in console.

Hello World
Welcome to Groovy programming

Things to notice
a.   Groovy file names end with .groovy extension
b.   Unlike Java, no need to define class and main methods

c.    No need to terminate the statement using semicolon



Previous                                                 Next                                                 Home

No comments:

Post a Comment