You can open the samples inside an IDE using the IntelliJ native importer or Eclipse Buildship.
If you are new to Gradle and wish to follow a more detailed tutorial for building Java applications, we suggest you have an look at the Building Java Applications guide.

This sample shows how a simple Java application can be built with Gradle. The application has no dependencies and the build has minimal configuration.

build.gradle
plugins {
    id 'application'
}

version = '1.0.2'
group = 'org.gradle.sample'

application {
    mainClassName = 'org.gradle.sample.Main'
}
build.gradle.kts
plugins {
    application
}

version = "1.0.2"
group = "org.gradle.sample"

application {
    mainClassName = "org.gradle.sample.Main"
}

To build and run the application:

$ ./gradlew run

> Task :run
Hello, World!

BUILD SUCCESSFUL in 1s
2 actionable tasks: 2 executed

For more information, see Application Plugin reference chapter. You can also get started quickly using the Build Init Plugin.