我是新来Kotlin 的
我使用此代码打开另一个活动:
startActivity(Intent(this,IntroAndLang::class.java))
当前活动和目标活动用Kotlin编写
我不明白为什么IntroAndLang::class.java
号楼没有:
号房而是::
号房?
我是新来Kotlin 的
我使用此代码打开另一个活动:
startActivity(Intent(this,IntroAndLang::class.java))
当前活动和目标活动用Kotlin编写
我不明白为什么IntroAndLang::class.java
号楼没有:
号房而是::
号房?
As stated in the docs this is a class reference:
Class References: 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.
It’s also the syntax for method references as in this simple example:
list.forEach(::println)
It refers to println
defined in Kotlin Standard library.