https://kotlinlang.org logo
Title
j

jiangxingbing

12/12/2018, 2:08 AM
Hello everyone, I have a question about interoperability between Kotlin and Java. I have a Kotlin class
A
extend from a Java class
Base
which has a static function
f()
. When I called
A.f()
in a Kotlin file the IDE give an error ” Unresolved reference: f “. But when I called
A.f()
in a Java class, It works fine. I want to know the reason and maybe correct implementation. Thanks!
g

gildor

12/12/2018, 2:45 AM
It’s correct, you should call Base.f() in Kotlin There are no statics in Kotlin and Kotlin doesn’t allow to use parent static methods using child class as Java