Answers to Self-Review Exercises

H.1 Memory exhaustion, array index out of bounds, arithmetic overflow, division by zero, invalid method parameters.

H.2

(a) Exception handling is designed to handle infrequently occurring situations that often result in program termination, not situations that arise all the time.

(b) Flow of control with conventional control structures is generally clearer and more efficient than with exceptions.

(c) The additional exceptions can get in the way of genuine error-type exceptions. It becomes more difficult for you to keep track of the larger number of exception cases.

H.3 It’s unlikely that methods of classes in the Java API could perform error processing that would meet the unique needs of all users.

H.4 A “resource ...

Get Android™ How to Program, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.