This example shows how to create a custom exception class in Kotlin by extending the Exception class. The custom exception is thrown inside a function called test(). In the main function, the test() call is wrapped in a try-catch block that catches the custom exception type. When the exception is thrown, normal execution stops and control jumps to the catch block. The catch block prints the exception's message, "Oops!", preventing the program from crashing. This flow helps handle specific errors clearly and safely.