How to get type of a variable in Kotlin?

Posted by Jessica Taylor | Updated on

Want to get type of a variable in Kotlin? You can use the is operator to check whether an object is of a specific type:

You can also get the type as String using reflection:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers