Assume a kotlin function is defined outside of a class as top level function.
Util.kt
:
class Util {
fun bar()
}
fun foo(){}
How can I call method foo()
in Java?
Join Stack Overflow to learn, share knowledge, and build your career.
foo
will be compiled to a static function in a class whose name is that of the Kotlin source file with the suffix Kt
- so in this case, you can say UtilKt.foo()
.