• +91 9723535972
  • info@interviewmaterial.com

Kotlin Interview Questions and Answers

Question - What are Reified types in Kotlin?

Answer -

When you are using the concept of Generics to pass some class as a parameter to some function and you need to access the type of that class, then you need to use the reified keyword in Kotlin.

For example:

inline fun genericsExample(value: T) {
 println(value)
 println("Type of T: ${T::class.java}")
}
fun main() {
 genericsExample("Learning Generics!")
 genericsExample(100)
}

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners