+ 1

Error with user defined exception type

Why can't I throw an exception in the class method and catch it in main method? Look at my code. How to fix the error? https://code.sololearn.com/cXuqE2OljJCO/?ref=app

7th Oct 2021, 6:05 AM
Rishi
Rishi - avatar
1 Odpowiedź
+ 3
Elsa thank you. I used your first solution because it is reliable. So that the user of the class can choose how to handle the exception, and they don't have to change the source code of the class to change how to exception is handled. Thank you again =)
7th Oct 2021, 9:24 AM
Rishi
Rishi - avatar