Get type of a variable in Kotlin

Viewed 68690

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?
3 Answers

You can use like this:

val value="value"
println(value::class.java.typeName)

you can get the class name with properties::class.simpleName

Related