Assertions and Java Exceptions
• Use try-catch and throw Statements
• Use catch, Multi-catch, and finally Clauses
• Use Autoclose Resources with a try-with-resources Statement
• Create Custom Exceptions and Auto-closeable Resources
• Test Invariants by Using Assertions
Q&A Self Test
The assertion mechanism gives you a way to do testing and debugging checks on conditions you expect to smoke out while developing, when you don’t want the runtime overhead associated with ...