Google News
logo
Kotlin - Interview Questions
What is the use of @JvmStatic, @JvmOverloads, and @JvmFiled in Kotlin?
Following are the main usage of @JvmStatic, @JvmOverloads, and @JvmFiled in Kotlin :

@JvmStatic : The @JvmStatic annotation is used to tell the compiler that the method is a static method, and you can use it in Java code.

@JvmOverloads : The @JvmOverloads annotation is required when we need to use the default values passed as an argument in Kotlin code from the Java code.

@JvmField : The @JvmField annotation is used to access the fields of a Kotlin class from Java code without any getters and setters. We need to use the @JvmField in the Kotlin code.
Advertisement