Groovy Hello World

Groovy Hello World

If you are learning any new language first thing you would like to learn how to print Hello World message. This is very simple Groovy program which will print “Groovy Hello World Java Honk” on the console. We will not go in details but next series of tutorial you will find details explanation of it:

  • GroovyHelloWorld.groovy:
package com.javahonk

class GroovyHelloWorld {

	def name	
	def printGroovyHelloWorld() {
		"Groovy Hello World ${name}"
	}
	
	static main(args) {
		def groovyHelloWorld = new GroovyHelloWorld()
		groovyHelloWorld.name = "Java Honk"
		println groovyHelloWorld.printGroovyHelloWorld()
		
	}
}
  • Output:

Groovy Hello World

For more information please visit Groovy official site

Leave a Reply

Your email address will not be published. Required fields are marked *