mathew murphy
09/04/2019, 6:35 PMmister11
09/06/2019, 3:10 PMAny
will solve your problem. You can call toString
on Any
object which is every object you create in Kotlin.
And then, if you pass it a type that overrides basic implementation of toString
(custom data class
, built-in data class
, custom class
that overrides toString
, ...), you'll get that exact output. If you pass it some other object, it will fallback and print just it's reference alongside it's class name.