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?
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()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With