Javatpoint Logo
Javatpoint Logo

First Groovy Program

In the last tutorial, we have seen how to create a project and a class of groovy in eclipse. In this tutorial, we will create a simple program and learn how to run it on eclipse as well as on command prompt.

Here is the directory structure of the project.

First Groovy Program

Example 1: Demo.groovy

How to run the above program by using eclipse.

To run the above program on eclipse, right click on the screen and click on the Run As, and then on java application.

First Groovy Program

Output:

First Groovy Program

How to run the above program by using command prompt.

To run the program using command prompt, go to the folder where the program is saved.

First Groovy Program

Now, click on the address bar and type cmd and press enter key.

First Groovy Program
  • Type the groovy demo.groovy in cmd, and then press enter key.
First Groovy Program

The above screen shows the output of the program in cmd.







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