

If you are using IntelliJ IDEA, go to Run > Edit Configurations to view this class. It's because the Kotlin compiler creates the class for us. Unlike Java, it is not mandatory to create a class in every Kotlin program.Here's an equivalent Java "Hello, World!" program. In this program, it prints Hello, World! and new line.Ĭomparison With Java "Hello, World!" programĪs you know, Kotlin is 100% interoperable with Java. The println() function prints the given message inside the quotation marks and newline to the standard output stream. You will learn about functions and parameters in later chapters.įor now, just remember that main function is a mandatory function which is the entry point of every Kotlin program. The function takes array of strings as a parameter and returns Unit.

The Kotlin compiler starts executing the code from the main function. This is the main function, which is mandatory in every Kotlin application. They are intended for person reading the code to better understand the intent and functionality of the program. When you run the program, the output will be: Hello, World!Īny line starting with // is a comment in Kotlin (similar to Java).
