How can we check the class instance of in kotlin?
Jun 16, 2020
in Kotlin
by Jordan
1 answers to this question.
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)
}
Jun 16, 2020
answered by Harshel