How can I find the variable type in Kotlin?
In Java there is instanceof
, but Kotlin does not exist:
val properties = System.getProperties() // Which type?
How can I find the variable type in Kotlin?
In Java there is instanceof
, but Kotlin does not exist:
val properties = System.getProperties() // Which type?
You can use the
is
operator to check whether an object is of a specific type:You can also get the type as
String
using reflection:Please note:
Source: https://kotlinlang.org/docs/reference/reflection.html#bound-class-references-since-11