RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Jun 28, 2021

How to Create the Hello World App in Kotlin

Kotlin is a programming language that many think will eventually replace Java. Indeed, that was the intent of the language when it was developed by the folks at Jet Brains. Jet Brains, as you may or may not know, are the people behind a ton of developer tools, including debuggers and a slew of integrated development environments (IDE) and code editors.

As such, Kotlin has much in common with Java - they both use the same libraries and are 100% interoperable, meaning that you can code the two languages side-by-side. There are some key differences between the two, but Kotlin will probably overtake Java in the programming world at some point. Today, we are going to look at how to create the most basic of Kotlin programs - that old standby, the "Hello, World!" application. A right of passage for every programmer!

If you know Java, then this program will feel slightly familiar, though it does differ from the way you would write it in Java:

// This is how you write a comment in Kotlin
// Creating the Kotlin Hello World Program

// Define the main function
fun main(args: Array) {
// This is how you create a print statement in Kotlin
	println("Hello, World!")

The above Kotlin code creates a main function, which contains our print statement that we use to print out the text "Hello, World!" to the user's screen. This is the output from the above program if you were to run it:

Hello, World!
James Payne
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date