Kotlin

Kotlin Type Conversion1 min read

In Kotlin, a numeric value of one type will not automatically converted to another type even when the other type is larger. This is different from how Java handles numeric conversions.

In the above program you can see that size of Long is larger than Int, but Kotlin doesn’t automatically convert Int to Long.




In Kotlin we need to use toLong() explicitly to convert to Long. Please go through the program which explains about the Type Conversion in Kotlin.

Leave a Comment