Home > database >  How to access Object class from Kotlin in Java
How to access Object class from Kotlin in Java

Time:09-15

I am new to Kotlin. I have a kotlin Object class like

@Parcelize
object AddCard

I want to access it in a Java class. if I have to do so I read that i have to give @JVMStatic annotation to the object class.something like

@JVMStatic @Parcelize object AddCard

when I add the annotation it says "This annotation is not applicable to target object." Please suggest how to handle this.

CodePudding user response:

You don't have to do anything special. You can access it from Java with just AddCard.INSTANCE.

  • Related