-1

I'll be direct, my question is what mean ::class in kotlin? I also want to know what means ::class.java. I see a lot of this commands but i never understand what this really mean. E.g: MyClass::class.java

Cássio
  • 13
  • 3

1 Answers1

1

Web search for "::class" in kotlin finds Class references in the Reflection chapter of the Kotlin Language Guide:

The most basic reflection feature is getting the runtime reference to a Kotlin class. To obtain the reference to a statically known Kotlin class, you can use the class literal syntax:

val c = MyClass::class

The reference is a value of type KClass.

Note that a Kotlin class reference is not the same as a Java class reference. To obtain a Java class reference, use the .java property on a KClass instance.

Andreas
  • 154,647
  • 11
  • 152
  • 247