Program lines order

Report a typo

We have a program where a custom exception is defined. Then a function is created such that if its second parameter is zero, it throws the custom exception. The function is called with a try-catch statement in the main(). When the exception is caught, an error message is printed.

Put the program lines in the correct order using proper indentation (4 spaces).

You have to create the class DivisionByZero first, then the function integerDivision().

Reorder lines using drag or arrows. Adjust indentation with left buttons
                println("Division by zero")
              
                fun integerDivision(a: Int, b: Int): Int {
              
                }
              
                return a / b
              
                }
              
                } catch (e: DivisionByZero) {
              
                class DivisionByZero: ArithmeticException()
              
                integerDivision(4, 0)
              
                try {
              
                if (b == 0) throw DivisionByZero()
              
                }
              
                fun main() {
              
___

Create a free account to access the full topic