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.
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.
👍 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)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Two minor things: there is no need to have an
object Main
, it will work with a simple top-level functionmain
. Since top-level functions are automaticallystatic
, you can then also omit the@JvmStatic
annotation.Functions in Kotlin are
public
by default, so you can omit the keyword forsayHelloWorld
.Agreed, IDE does greyed out
public
keyword, and forobject Main {...}
, since i am from java background thought this would least look similarpsvm in a test class
.👍 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)