There is no static
keyword in Kotlin.
What is the best way to represent a static
Java method in Kotlin?
There are 2 ways you can apply static in Kotlin
First make a companion object under class
For ex:
class Test{
companion object{
fun isCheck(a:Int):Boolean{
if(a==0) true else false
}
}
}
you can call this function as
Test.Companion.isCheck(2)
Another way we can use is to make an object class
object Test{
fun isCheck(a:Int):Boolean{
if(a==0) true else false
}
}
Happy Coding!