DEV Community

[Comment from a deleted post]
Collapse
 
lovis profile image
Lovis

Two minor things: there is no need to have an object Main, it will work with a simple top-level function main. Since top-level functions are automatically static, you can then also omit the @JvmStatic annotation.
Functions in Kotlin are public by default, so you can omit the keyword for sayHelloWorld.

Collapse
 
silentsudo profile image
Ashish Agre

Agreed, IDE does greyed out public keyword, and for object Main {...}, since i am from java background thought this would least look similar psvm in a test class.

Collapse
 
lovis profile image
Lovis

👍 you're right it makes it more similar.
One great thing with Kotlin is how much code you can save, so I thought it's worth mentioning (especially since @JvmStatic is ugly)