O'Reilly logo

Groovy Programming by John Savage, Kenneth Barclay

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 5 SIMPLE INPUT AND OUTPUT

Strictly, input and output facilities are not part of the Groovy language. Nonetheless, real programs do communicate with their environment. To produce simple text output in Groovy, we use statements of the form:

The methods print and println are used to display the value concerned (denoted by xxx). The value may represent a String literal, a variable or expression, or an interpreted String. Method print outputs its value, and any further output appears on the same output line. Method println advances to the next output line after displaying its value.

5.1 SIMPLE OUTPUT

Example 01 demonstrates how to print ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required