Javatpoint Logo
Javatpoint Logo

Basic syntax in groovy

The following are the conditions applied while writing the groovy program:

  • In groovy, it is not necessary to put a semicolon at the end of the statement like in java.

Example:

Output:

Basic syntax in groovy
  • In groovy, we can print a line without using round brackets

Example:

Output:

Basic syntax in groovy
  • In groovy, double quotes as well as single quotes can be used in a string.

Example:

Output:

Basic syntax in groovy
  • We can have a single line comment as well as a multi-line comment just like in java.

Example:

Output:

Basic syntax in groovy
  • In Groovy, it is not necessary to have a class or the main function.

Example:

Output:

Basic syntax in groovy
Next TopicGroovy Operators





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA