Converting to string

Report a typo

Here is an example of a function in Kotlin that takes an object of type Any and converts it to a String using the "unsafe" type reduction operator (as):

fun main() {
    println(convertToString(5))
}

fun convertToString(obj: Any): String {
    return obj as String
}

What will be printed after this program is executed?

Select one option from the list
___

Create a free account to access the full topic