Groovy?
Groovy is an agile dynamic language for the Java Platform with many features that are inspired by languages like Python, Ruby and Smalltalk, making them available to Java developers using a Java-like syntax.
The Best thing to learn any programming language is to write programs. So lets get started.
Hope you guys are using Linux/ Unix.
Installing Groovy on your system
sudo apt-get install groovy
Running Groovy
Let me introduce to the tools you'll be using to run Groovy Code.
There are three commands to execute Groovy code
1. groovysh :- Starts the groovysh command-line shell
2. groovyConsole :- Starts a graphical interface that is used to execute Groovy code
3. groovy :- Starts the interpreter that executes Groovy scripts
The first program in any language is to print Hello World.
Here we go....
Using groovysh for “Hello World”
To start the shell, run
groovysh
You should then get a command prompt like this
Lets get Groovy!
================
Version: 1.0-RC-01-SNAPSHOT JVM: 1.4.2_05-b04
Type 'exit' to terminate the shell
Type 'help' for command help
Type 'go' to execute the statements
groovy>
groovy> "Hello, World!"
groovy> go
===> Hello, World!
The go command is one of only a few commands the shell recognizes.
The first program in any language is to print Hello World.
Here we go....
Using groovysh for “Hello World”
To start the shell, run
groovysh
You should then get a command prompt like this
Lets get Groovy!
================
Version: 1.0-RC-01-SNAPSHOT JVM: 1.4.2_05-b04
Type 'exit' to terminate the shell
Type 'help' for command help
Type 'go' to execute the statements
groovy>
groovy> "Hello, World!"
groovy> go
===> Hello, World!
The go command is one of only a few commands the shell recognizes.