This assumes that you have setup groovy as per Setting up Groovy and groovysh beginner for eval exp, dynamic typing, operator overloading & closure.
Step 1: Start the groovyConsole from a command prompt
Step 2: Run the following Groovy Plain Old Object code
Execute it as a Groovy script.
…