Method that returns an exception

Report a typo

Look at this code:

fun main() {
    val input = "1 2 3 4 5 6 7 8 9 10"
    demoList(input)
}

fun demoList(input: String) {
    val inputList = input.split(" ")
    println(inputList[-1])
}

When you compile this code, it throws an exception. Which function throws the exception?

Select one option from the list
___

Create a free account to access the full topic