Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
Groovy is a dynamic language for the Java Virtual Machine, created by James Strachan and first released in 2003. It keeps Java's semantics and libraries but drops much of the ceremony: semicolons are optional, types can be inferred, and closures and builders are first-class. Most developers meet Groovy through tools rather than standalone apps, since Gradle build files, Jenkins pipeline scripts, and Spock test specifications are all written in it. On XCODX it runs on a stock JVM through the Piston sandbox, so the Groovy JDK (GDK) enhancements and the Java standard library are available for scripting, string processing, and quick algorithm work. The runtime version is printed in the badge above the editor, and there is nothing to install on your own machine.
def stdin = System.in.newReader()
print 'What is your name? '
def name = stdin.readLine()
print 'How many stars? '
def count = stdin.readLine().toInteger()
println "Hello, ${name}!"
println '*' * count
Groovy shines when you want Java's ecosystem with far less boilerplate: quick scripts, text munging, prototyping algorithms, and readable domain-specific languages. Choose it when you already live in the JVM world and want a scripting layer for build automation or test specifications rather than a full compiled application. Its dynamic dispatch makes it slower than statically compiled Java or Kotlin, so it is a poor fit for tight numeric loops or latency-critical hot paths. In this sandbox it is well suited to learning the language and exercising standard-library code without a local Gradle or Maven setup.
No. The sandbox runs Groovy with only the Groovy JDK (GDK) and the Java standard library. @Grab, Maven, and Gradle all need network access to download artifacts, and there is no network or dependency install here, so third-party libraries are unavailable.
Create a reader over standard input, for example def stdin = System.in.newReader(), then call stdin.readLine(). On XCODX you can type into the live terminal, which streams your input as the program runs, or paste it into the Stdin Box before running; press Ctrl+D to close the stream.
No, but it is closely related. Groovy runs on the JVM and can use any Java library, yet it adds dynamic typing, optional syntax, closures, and GDK convenience methods. A large subset of Java code also runs unchanged as Groovy, which makes it easy to pick up if you already know Java.
readLine() always returns a String, so "5" stays text until you convert it. Use a GDK coercion such as .toInteger(), .toDouble(), or as Integer before doing arithmetic, otherwise the + operator will concatenate strings instead of adding them.
The exact runtime version is shown in the badge above the editor. The environment is stateless, so the filesystem is reset on every run and nothing persists; copy any code you want to keep, because there is no saved workspace.
No. This sandbox executes a single Groovy script, not a Gradle or Jenkins environment, and those tools and their plugins are not installed. You can still practice the Groovy language features that those tools are built on.
Main.groovygroovySystem.inprintln "Hello from Groovy!"
println "Welcome to XCODX Online Compiler!"
def message = "Groovy is dynamic!"
println message