diff --git a/_posts/groovy/2020-12-31-hello-world-in-groovy.md b/_posts/groovy/2020-12-31-hello-world-in-groovy.md new file mode 100644 index 0000000..b9c320c --- /dev/null +++ b/_posts/groovy/2020-12-31-hello-world-in-groovy.md @@ -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/) \ No newline at end of file diff --git a/_posts/2019-11-29-java-introduction.md b/_posts/java-basic/2019-11-29-java-introduction.md similarity index 100% rename from _posts/2019-11-29-java-introduction.md rename to _posts/java-basic/2019-11-29-java-introduction.md diff --git a/_posts/2020-12-24-convert-stringbuilder-to-string-in-java.md b/_posts/java-string/2020-12-24-convert-stringbuilder-to-string-in-java.md similarity index 100% rename from _posts/2020-12-24-convert-stringbuilder-to-string-in-java.md rename to _posts/java-string/2020-12-24-convert-stringbuilder-to-string-in-java.md diff --git a/_posts/2020-12-19-uuid-in -java.md b/_posts/java-uuid/2020-12-19-uuid-in -java.md similarity index 100% rename from _posts/2020-12-19-uuid-in -java.md rename to _posts/java-uuid/2020-12-19-uuid-in -java.md diff --git a/_posts/2020-12-23-create-uuid-in-java.md b/_posts/java-uuid/2020-12-23-create-uuid-in-java.md similarity index 100% rename from _posts/2020-12-23-create-uuid-in-java.md rename to _posts/java-uuid/2020-12-23-create-uuid-in-java.md diff --git a/assets/images/2020-12-31/groovy-console-in-start-menu.png b/assets/images/2020-12-31/groovy-console-in-start-menu.png new file mode 100644 index 0000000..ce9229d Binary files /dev/null and b/assets/images/2020-12-31/groovy-console-in-start-menu.png differ diff --git a/assets/images/2020-12-31/groovy-hello-world-output.png b/assets/images/2020-12-31/groovy-hello-world-output.png new file mode 100644 index 0000000..2a30234 Binary files /dev/null and b/assets/images/2020-12-31/groovy-hello-world-output.png differ diff --git a/assets/images/2020-12-31/groovy-hello-world-program-and-run-option.png b/assets/images/2020-12-31/groovy-hello-world-program-and-run-option.png new file mode 100644 index 0000000..cea8fac Binary files /dev/null and b/assets/images/2020-12-31/groovy-hello-world-program-and-run-option.png differ diff --git a/assets/images/2020-12-31/groovy-installation-screen.png b/assets/images/2020-12-31/groovy-installation-screen.png new file mode 100644 index 0000000..ec7c2fe Binary files /dev/null and b/assets/images/2020-12-31/groovy-installation-screen.png differ diff --git a/assets/images/2020-12-31/groovy-logo.png b/assets/images/2020-12-31/groovy-logo.png new file mode 100644 index 0000000..d6d7649 Binary files /dev/null and b/assets/images/2020-12-31/groovy-logo.png differ