Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Add new blogpost, Hello World In Groovy #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions _posts/groovy/2020-12-31-hello-world-in-groovy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
layout: post
title: "Hello World In Groovy"
author: gaurav
image: assets/images/2020-12-31/groovy-logo.png
categories: [ Groovy]
description: "In this article you will say 'Hello' to Groovy. We will see the installation and 'the' most important 'Hello World!' program."
featured: false
---
In this article, you will say 'Hello' to Groovy. We will see the installation and 'the' most important "Hello World!" program. 🙂

Apache Groovy is a **powerful**, **optionally typed**, and **dynamic** language. It integrates smoothly with any Java program.

## How To Install Groovy?

There are many ways you can [download and Install Groovy](https://groovy.apache.org/download.html).

On this day, Groovy 3.0 is the latest stable version of Groovy designed for JDK8+.

Currently, I am using Windows so we will be using a Windows installer, which is a community artifact.

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).

Once you download the .msi file ( i.e. installer) simply double click on it and you will see the installation screen.

![Groovy Installation Screen](/assets/images/2020-12-31/groovy-installation-screen.png)

The installation is pretty simple and straight-forward. Click on next and go with the default setting.

**Note:** If you are **using Mac OS** and you have Homebrew, you can install Groovy by the following command.

```
brew install groovy
```

Refer to the [official installation guide](https://groovy-lang.org/install.html) for more information.

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.

![Groovy Console in the Start Menu](/assets/images/2020-12-31/groovy-console-in-start-menu.png)


## Hello World In Groovy

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).

Things are pretty much different here.

You can simply write the print statement with your "Hello World!" string and it will get printed on the console.

So let's try.

Open your Groovy Console. Add the following statement to it.

```groovy
println "Hello World!"
```
![Groovy Hello World Program In the Groovy Console](/assets/images/2020-12-31/groovy-hello-world-program-and-run-option.png)

To run your program right click on the console and choose the 'Run' option.

You can also use the shortcut `Ctrl+R` to run any groovy program.

Boom!! 🎉

You can see the string "Hello World!" is printed on the console.

![Groovy Hello World Program Output](/assets/images/2020-12-31/groovy-hello-world-output.png)

So you have successfully written your first groovy program.

That's it for now.

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.

--------------

You can support me by [giving a cup of Coffee ☕](https://www.paypal.me/GauravKukade)

#### Related Articles

- [8 Basic GIT Commands Every Newbie Developer Must Know](https://coderolls.com/basic-git-commands/)
- [How To Reverse A String In Java (5 ways)](https://coderolls.com/reverse-a-string-in-java/)
- [How To Create UUID in Java?](https://coderolls.com/create-uuid-in-java/)
- [Learn About Java String Pool And intern() Method](https://coderolls.com/java-string-pool-and-intern-method/)
- [How Do I Compare Strings In Java](https://coderolls.com/compare-strings-in-java/)
- [Compare Two Strings Lexicographically In Java](https://coderolls.com/compare-two-strings-lexicographically-in-java/)
- [Difference Between StringBuffer and StringBuilder class](https://coderolls.com/difference-between-stringbuffer-and-stringbuilder/)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/2020-12-31/groovy-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.