Reusing code with Object

Report a typo

Take a look at the following non-generic class:

class NonGenericClass(val value: Any) {

    fun get(): Any {
        return value
    }
}

And here is an instance of this class:

val instance: NonGenericClass = NonGenericClass("Hello")

Now we want to get the string back. In which case will the code throw a runtime exception?

Select one option from the list
___

Create a free account to access the full topic