Write code that throws RuntimeException. Do not print anything in the output of the program.
Hierarchy of exceptions
RuntimeException
Report a typo
Write a program in Kotlin
fun main() {
try {
// write your code here, do not touch the lines above
// do not touch the lines below
} catch(e: RuntimeException) {
println("Well")
} catch (e: Exception) {
println("Wrong")
}
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.