Explore Kotlin with My Playground

Quickly Experiment with Kotlin Online - No Installation Required!

Welcome to my Kotlin Playground, where you can effortlessly experiment with Kotlin code targeting both the Java and JavaScript platforms. This interactive page allows you to explore the powerful features of Kotlin, speeding up your learning progress and enhancing your development skills.

Start coding now and discover the potential of Kotlin for your projects! Whether you're building backend applications or exploring frontend development, this playground can help you mastering Kotlin.

Backend servers are kindly provided by JetBrains.

Kotlin to Java

With Kotlin targeting the Java platform, you can leverage all the powerful language features and APIs provided by the JDK, enabling seamless integration and development.

import java.util.Arrays import java.util.stream.Collectors fun main(args: Array<String>) { // How one might do it with plain Java APIs val javaWords = Arrays.asList("hello", "world", "in", "java") System.out.println(javaWords.stream().collect(Collectors.joining(" "))) // How one might do the same with Kotlin APIs val kotlinWords = listOf("hello", "world", "in", "kotlin") println(kotlinWords.joinToString(separator = " ")) }

Kotlin to JavaScript

When targeting web browsers, Kotlin code does not support APIs provided by the JDK unless they have been re-implemented for the JavaScript environment. However, you can call any JavaScript API directly.

For more information, check out these resources:

fun main(args: Array<String>) { alert("Hello World!") console.log("Hello World!") } // Serves sort of like a header declaration. The keyword 'external' tells Kotlin that the // actual implementation is provided by the developer or the platform. In this case it's // Window.alert(). external fun alert(message: String) // Or Window.console. Execute this code snippet and have a look in your web browser's // script console. The type 'dynamic' is only available for the JavaScript platform and // basically disables any type check for this value. external val console: dynamic;