Let's check out a simple kotlin program to print hello world to the console.
Let's check out a simple kotlin program to print hello world to the console.
Here's the program to print hello world to the console.
package demo
fun main(args : Array<String>){
println("hello world")
}
If you run the above program you will get the following output.
hello world
Now let's go the program and try to understand the way it works.
Its way more simple for developers with java background,and I strongly recommend get hands on java experience to get expertise on kotlin.
The program starts with package deceleration , which is optional. If you do not declare the package the file goes to the default package . You have few restrictions for the package name . You cannot name package as java , this is same for the programs written in java language. But kotlin is different from java , you can actually name your package as kotlin .