
- Groovy Tutorial
- Groovy - Home
- Groovy - Overview
- Groovy - Environment
- Groovy - Basic Syntax
- Groovy - Data Types
- Groovy - Variables
- Groovy - Optionals
- Groovy - Numbers
- Groovy - Strings
- Groovy - Ranges
- Groovy - Lists
- Groovy - Maps
- Groovy - Dates & Times
Groovy Operators
- Groovy - Operators
- Groovy - Arithmetic Operators
- Groovy - Assignment Operators
- Groovy - Relational Operators
- Groovy - Logical Operators
- Groovy - Bitwise Operators
- Groovy - Spaceship Operator
- Groovy - in Operator
- Groovy - Elvis Operator
- Groovy - Safe Navigation Operator
- Groovy Operator Precedence & Associativity
Control Statements
- Groovy - Decision Making
- Groovy - If Else Statement
- Groovy - Switch Statement
- Groovy - Loops
- Groovy - For Loop
- Groovy - For-in Loop
- Groovy - While Loop
- Groovy - Do While Loop
- Groovy - Break Statement
- Groovy - Continue Statement
Groovy File Handling
- Groovy - File I/O
- Java - Create a File
- Java - Write to File
- Java - Append to File
- Java - Read Files
- Java - Delete Files
- Java - File Properties
- Java - File Existence and Type
- Java - File Size
- Java - File Permissions
- Java - Directories
- Java - Listing Directories
- Java - Filtering Files/Directories
- Java - Deleting Directories
- Java - Renaming Files/Directories
Groovy Error & Exceptions
- Groovy - Exception Handling
- Groovy - try-catch Block
- Groovy - try-with-resources
- Groovy - Multi-catch Block
- Groovy - Nested try Block
- Groovy - Finally Block
- Groovy - throw Exception
- Groovy - Exception Propagation
- Groovy - Built-in Exceptions
- Groovy - Custom Exception
Groovy Multithreading
- groovy - Multithreading
- groovy - Thread Life Cycle
- groovy - Creating a Thread
- groovy - Starting a Thread
- groovy - Joining Threads
- groovy - Naming Thread
- groovy - Thread Scheduler
- groovy - Thread Pools
- groovy - Main Thread
- groovy - Thread Priority
- groovy - Daemon Threads
- groovy - Shutdown Hook
Groovy Synchronization
- groovy - Synchronization
- groovy - Block Synchronization
- groovy - Static Synchronization
- groovy - Inter-thread Communication
- groovy - Thread Deadlock
- groovy - Interrupting a Thread
- groovy - Thread Control
- groovy - Reentrant Monitor
- Groovy - Methods
- Groovy - Methods
- Groovy - Optional parenthesis
- Groovy - Named Arguments
- Groovy - Closures as Arguments
- Groovy - Method Overloading
- Groovy - Method Scope and Visibility
- Groovy - isCase Method
- Groovy - Implicit Return
- Groovy - Variable Arguments
- Groovy - Regular Expressions
- Groovy - Regular Expressions
- Groovy - Defining Regular Expressions
- Groovy - Matcher Object
- Groovy - Regex Tasks
- Groovy - XML
- Groovy - XML
- Groovy - Parsing XML
- Groovy - Creating XML
- Groovy - Modifying XML
- Groovy - Querying XML
- Groovy - Simplified Notation
- Groovy - Closure based Querying
- Groovy - Closure based Creation
- Groovy - JSON
- Groovy - JSON
- Groovy - Parsing JSON
- Groovy - Creating JSON using JsonOutput
- Groovy - Creating JSON using JsonBuilder
- Groovy - Modifying JSON
- Groovy - Error Handling
- Groovy - Handling JSON Arrays
- Groovy - JSON Array Operations
- Groovy - JSON Objects
- Groovy - JSON Object Operations
- Groovy - Generics
- Groovy - Generics
- Groovy - Declaring Generic Types
- Groovy - Bound Type Parameters
- Groovy - Wild Cards
- Groovy - Miscellaneous
- Groovy - Object Oriented
- Groovy - Closures
- Groovy - Annotations
- Groovy - JMX
- Groovy - DSLS
- Groovy - Database
- Groovy - Builders
- Groovy - Command Line
- Groovy - Unit Testing
- Groovy - Template Engines
- Groovy - Meta Object Programming
- Groovy Useful Resources
- Groovy - Quick Guide
- Groovy - Useful Resources
- Groovy - Discussion

Groovy Tutorial
Groovy is an object oriented language which is based on Java platform. Groovy 1.0 was released in January 2, 2007 with Groovy 5.0.0 as the current major release. Groovy is distributed via the Apache License v 2.0.
This Groovy tutorial is based on the latest stable version 5.0.0.
What is Groovy
Groovy is a multi-faceted Java like language with added features. Groovy supports object oriented programming along with functional programming. Groovy exhibits both static as well as dynamic nature. Groovy provides strong envionment to create Domain Specific Languages. Groovy is fully interoperaable with Java and provide language extensions using in-language macros, AST transformations and meta programming capabilities.
Groovy First Example
The first example in Groovy is to print "Hello, World!" on the screen. Let's have a quick look at the first examples in Groovy programming:
// My first groovy program to print Hello, World! on the screen print("Hello, World!")
Getting Started with Groovy
Explore the following chapters to get started learning Groovy programming:
- Groovy - Environment
- Groovy - Basic Syntax
- Groovy - Data Types
- Groovy - Variables
- Groovy - Optionals
- Groovy - Numbers
- Groovy - Strings
- Groovy - Ranges
- Groovy - Lists
- Groovy - Maps
- Groovy - Dates & Times
Online Groovy Compiler
Our Groovy programming tutorial provides various examples to explain the concepts. To compile and execute the given Groovy programming examples in your browser itself, we have provided Online Groovy Compiler. You can edit and run almost all the examples directly from your browser without the need to set up your development environment.
Try to click the icon to run the following Groovy code to print conventional "Hello, World!" using Groovy Programming.
Below code box allows you to change the value of the code. So, please try to change the value inside println() and run it again to verify the result.
// prints Hello, World! on the screen print("Hello, World!")
Features of Groovy
Groovy has the following features −
Support for both static and dynamic typing.
Support for operator overloading.
Native syntax for lists and associative arrays.
Native support for regular expressions.
Native support for various markup languages such as XML and HTML.
Groovy is simple for Java developers since the syntax for Java and Groovy are very similar.
You can use existing Java libraries.
Groovy extends the java.lang.Object.
Groovy Jobs & Opportunities
Groovy is very in demand, and all the major companies are recruiting Groovy programmers to develop their desktop, web, and mobile applications.
Today, a Groovy programmer with 3-5 years of experience is asking for around $120,000 in an in an annual package, and this is the most demanding programming language in America. Though it can vary depending on the location of the job. Following are the great companies that are using Groovy and they need good Groovy programmers:
- Microsoft
- IBM
- Amazon
- Netflix
- Uber
- JetBrains
- Many more...
So, you could be the next potential employee for any of these major companies. We have developed great learning material for Groovy that will help you prepare for the technical interviews and certification exams based on Groovy. So, start learning Groovy using this simple and effective tutorial from anywhere and anytime, absolutely at your pace.
Why to Learn Groovy?
Groovy is a MUST to learn programming language for students and working professionals to become a great software engineer, especially when they are working in the software development domain. If you will conduct a survey about the best programming language around, Groovy is sure to come up.
Groovy is a fairly easy programming language to learn, so if you are starting to learn any programming language, then Groovy could be your great choice. There's also plenty of Groovy tools that make it easy for developers and beginners to use. There are many other good reasons that make Groovy the first choice of any programmer:
- Groovy is open source, which means it's available free of cost.
- Groovy is simple and so easy to learn.
- Groovy is much in demand and ensures a high salary.
- Groovy has a large, vibrant community.
- Groovy has powerful development tools.
- Groovy is platform-independent.
Audience: Who can Learn Groovy?
This Groovy tutorial is designed for aspiring developers with a need to understand the Groovy in enough detail along with its simple overview and practical examples. This tutorial will give you enough ingredients to start with Groovy, from where you can take yourself to a higher level of expertise.
Prerequisites to Learn Groovy
Before proceeding with this Groovy you should have a basic working knowledge of the Java; additionally, you must be familiar with −
- Experience with any text editor like Notepad, Notepad++, or Edit Plus etc.
- How to create directories and files on your computer.
- How to navigate through different directories.
- How to type content in a file and save it on a computer.
- Basic understanding of coding