© Peter Späth 2019
Peter SpäthLearn Kotlin for Android Developmenthttps://doi.org/10.1007/978-1-4842-4467-8_8

8. Exceptions: If Something Goes Wrong

Peter Späth1 
(1)
Leipzig, Germany
 

For very simple programs it is probably easy to make sure all program parts do exactly what they are supposed to. For programs with a higher level of complexity, those built by many developers, or those that use external programs (libraries), the situation is not that clear. Problems will arise, for example, if lists or arrays get addressed out of bounds, some I/O access to files or network data streams fails, or objects end up in an unanticipated or corrupted state.

This is what exceptions are for. Exceptions are objects that get created or thrown if something unanticipated ...

Get Learn Kotlin for Android Development: The Next Generation Language for Modern Android Apps Programming 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.