We're all friends here, even the exceptions

  • 3
  • Locked
There was a time when exceptions kept young scientists and programmers awake at night. Today they have that effect on CodeGym students. Let's try creating our own exceptions. To do this, we have the MyException, MyException2, MyException3, and MyException4 classes. Let's have the classes inherit other classes so as to produce any two checked exceptions and any two unchecked exceptions.
You can't complete this task, because you're not signed in.
Comments (3)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
June Sung Park
Level 41 , Yangp'yong, Korea, Republic of
31 March 2020, 04:38
To give a little more hint on top of what Horst suggested, you can inherit a checked exception class such as IOException to create a class that is a checked exception, and inherit an unchecked exception class such as RuntimeException to create a class that is an unchecked exception.
horst
Level 26 , Not in list
19 January 2020, 21:53
In case of doubt you might want to revise the article on checked and unchecked exceptions and especially what their names are...
Maxine Hammett
Level 19 , San Diego, United States
20 July 2020, 16:16
I'm still lost. Can you please explain to me how to throw the exception from an exteded class?