Posted on 16th September 2024|40 views
How can we check the class instance of in kotlin?
Posted on 16th September 2024| views
Class "instance of" can be checked by using the keyword is or !is
A simple example is given below:
if(myInstance is string)
{
print(string)
}
if(myInstance !is string)
{
print(not a string)
}
else
{
print(null)
}