CSE 143 Chapter 15: Throwing Exceptions

28 views1 pages
oliveherring648 and 7 others unlocked
CSE 143 Full Course Notes
6
CSE 143 Full Course Notes
Verified Note
6 documents

Document Summary

Throw an exception in the event that the clients disobey the precondition. Have the option to include a string that will be displayed with the exception. You should also (cid:373)e(cid:374)tio(cid:374) the e(cid:454)ceptio(cid:374) i(cid:374) the co(cid:373)(cid:373)e(cid:374)ts for the (cid:373)ethod. It"s i(cid:373)porta(cid:374)t to mention exactly which type of exception will be thrown and under what condition. In order to construct an exception object to be thrown, you have to decide what type of exception to use. Illegalargumentexception is a more general and broad exception. You can create a private method that each of the method calls if a specific test needs to be done.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions