Skip to content
Novus Examples
kt85 B

Kotlin — Hello World

The classic hello-world in Kotlin — a top-level main function — for testing highlighters, the Kotlin compiler, and parsers.

Preview — first 5 lineskt
// The classic first program, in Kotlin.
fun main() {
    println("Hello, world!")
}

Specifications

Language
Kotlin
Kind
hello-world
Lines
4
Encoding
UTF-8
Line Endings
LF

What is a .kt file?

Kotlin (.kt) is a plain-text source file for the Kotlin programming language — a statically typed, JVM language from JetBrains that interoperates with Java. It is the preferred language for modern Android development and features null safety, data classes, extension functions, and concise syntax.

How to use this file

Use an example .kt file to test syntax highlighters, the Kotlin compiler, linters and formatters (ktlint), and parser or language-detection tooling.

Generated by generation/code_samples.py. Free for any use, no attribution required — license.