Skip to main content

First Program in Kotlin

2 min read Updated June 30, 2026
Share:
On this page (11sections)

Overview

  • Kotlin is a general purpose, open source, the statically-typed programming language that runs on the JVM (Java virtual machine) infrastructure.
  • It is focused on Concise, simple, very easy to understand, safety, and library support.
  • Kotlin is an official language on Android
  • Kotlin is a fully supported programming language on Android via Android Studio 3.0

Here, Kotlin first program is a simple program that prints output “Hello, World! - www.littledrops.net” on the screen.

Setting up the Kotlin

Syntax

fun main(args: Array<String>) {
    // Main Program Code 
}

Simple Kotlin Example Program

// My First Program
fun main(args: Array<String>) {
    println("Hello, world! - www.littledrops.net")
}

Sample Output

Hello, world! - www.littledrops.net

How does Kotlin program work?

1. Comment line

// My First Program

The text preceded by // is a comment line in Kotlin (similar to C, C++, and Java). Comments are neglected by Kotlin compiler. Comments are designed for the better understanding of code and functionality and changes in the program.

2. Main Function

fun main(args : Array<String>) { ... }

This is the main function of the kotlin main function is mandatory in every Kotlin program like C and C++. It is the entry point of any Kotlin program.The Kotlin compiler begins executing kotlin program code from the main function.

3. Command Line Arguments (args: Array)

The function takes the array of strings as a parameter and returns Unit which is equivalent to String args[] in java.

4. println

println("Hello, world! - www.littledrops.net")

The println() function prints the given string inside the double quotation with a new line to the screen or output stream. The above line just prints Hello, world! - www.littledrops.net to the screen/stream.

Frequently Asked Questions

What is First in Kotlin?
First is demonstrated in this Kotlin tutorial with a complete, runnable example and its sample output.
How do I run this Kotlin example?
Run it in IntelliJ IDEA or Android Studio, or compile from the command line with `kotlinc file.kt -include-runtime -d file.jar` and run `java -jar file.jar`.
How can I practice First?
Copy the example into IntelliJ IDEA or Android Studio, run it, then change the values or add print statements to see how the output changes.

Related Tutorials

Search tutorials