In kotlin class, I have method parameter as object (See kotlin doc here ) for class type T. As object I am passing different classes when I am calling method.
In Java we can able to compare class using instanceof
of object which class it is.
So I want to check and compare at runtime which Class it is?
How can I check instanceof
class in kotlin?
Use is
.
if (myInstance is String) { ... }
or the reverse !is
if (myInstance !is String) { ... }