Skip to content

Commit a219e34

Browse files
committed
Add new blogpost, Hello World In Groovy
1 parent 755e4ff commit a219e34

10 files changed

+88
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
layout: post
3+
title: "Hello World In Groovy"
4+
author: gaurav
5+
image: assets/images/2020-12-31/groovy-logo.png
6+
categories: [ Groovy]
7+
description: "In this article you will say 'Hello' to Groovy. We will see the installation and 'the' most important 'Hello World!' program."
8+
featured: false
9+
---
10+
In this article, you will say 'Hello' to Groovy. We will see the installation and 'the' most important "Hello World!" program. 🙂
11+
12+
Apache Groovy is a **powerful**, **optionally typed**, and **dynamic** language. It integrates smoothly with any Java program.
13+
14+
## How To Install Groovy?
15+
16+
There are many ways you can [download and Install Groovy](https://groovy.apache.org/download.html).
17+
18+
On this day, Groovy 3.0 is the latest stable version of Groovy designed for JDK8+.
19+
20+
Currently, I am using Windows so we will be using a Windows installer, which is a community artifact.
21+
22+
Here is a [link for Windows Installer for Groovy 3.0.7](https://bintray.com/groovy/Distributions/download_file?file_path=groovy-3.0.7.msi).
23+
24+
Once you download the .msi file ( i.e. installer) simply double click on it and you will see the installation screen.
25+
26+
![Groovy Installation Screen](/assets/images/2020-12-31/groovy-installation-screen.png)
27+
28+
The installation is pretty simple and straight-forward. Click on next and go with the default setting.
29+
30+
**Note:** If you are **using Mac OS** and you have Homebrew, you can install Groovy by the following command.
31+
32+
```
33+
brew install groovy
34+
```
35+
36+
Refer to the [official installation guide](https://groovy-lang.org/install.html) for more information.
37+
38+
Once you are done with the installation, you can search for the Groovy Console from your start menu. And finally, you are ready to write your first "Hello World!" program.
39+
40+
![Groovy Console in the Start Menu](/assets/images/2020-12-31/groovy-console-in-start-menu.png)
41+
42+
43+
## Hello World In Groovy
44+
45+
Groovy is a JVM-based language. If you have used Java before you know [how we create a class, then method and write our print statement in it](https://youtu.be/P_r4QFLxBsQ).
46+
47+
Things are pretty much different here.
48+
49+
You can simply write the print statement with your "Hello World!" string and it will get printed on the console.
50+
51+
So let's try.
52+
53+
Open your Groovy Console. Add the following statement to it.
54+
55+
```groovy
56+
println "Hello World!"
57+
```
58+
![Groovy Hello World Program In the Groovy Console](/assets/images/2020-12-31/groovy-hello-world-program-and-run-option.png)
59+
60+
To run your program right click on the console and choose the 'Run' option.
61+
62+
You can also use the shortcut `Ctrl+R` to run any groovy program.
63+
64+
Boom!! 🎉
65+
66+
You can see the string "Hello World!" is printed on the console.
67+
68+
![Groovy Hello World Program Output](/assets/images/2020-12-31/groovy-hello-world-output.png)
69+
70+
So you have successfully written your first groovy program.
71+
72+
That's it for now.
73+
74+
You can visit my [YouTube channel 'coderolls'](https://www.youtube.com/channel/UCl31HHUdQbSHOQfc9L-wo3w?view_as=subscriber?sub_confirmation=1) to find more video tutorials.
75+
76+
--------------
77+
78+
You can support me by [giving a cup of Coffee ☕](https://www.paypal.me/GauravKukade)
79+
80+
#### Related Articles
81+
82+
- [8 Basic GIT Commands Every Newbie Developer Must Know](https://coderolls.com/basic-git-commands/)
83+
- [How To Reverse A String In Java (5 ways)](https://coderolls.com/reverse-a-string-in-java/)
84+
- [How To Create UUID in Java?](https://coderolls.com/create-uuid-in-java/)
85+
- [Learn About Java String Pool And intern() Method](https://coderolls.com/java-string-pool-and-intern-method/)
86+
- [How Do I Compare Strings In Java](https://coderolls.com/compare-strings-in-java/)
87+
- [Compare Two Strings Lexicographically In Java](https://coderolls.com/compare-two-strings-lexicographically-in-java/)
88+
- [Difference Between StringBuffer and StringBuilder class](https://coderolls.com/difference-between-stringbuffer-and-stringbuilder/)
Loading
Loading
Loading
75.2 KB
Loading

0 commit comments

Comments
 (0)