- The Java Workshop
- David Cuartielles Andreas G?ransson Eric Foster Johnson
- 202字
- 2021-06-11 13:05:25
Introduction
Exceptions are not errors, or, more accurately, exceptions are not bugs, even if you might perceive them to be when they crash your programs. Exceptions are situations that occur in your code when there is a mismatch between the data you are handling and the method or command you are using to process it.
In Java, there is a class that is dedicated to errors. Errors are unexpected situations that affect programs on the Java Virtual Machine (JVM) level. For example, if you fill-up the program stack through an unconventional use of memory, then your whole JVM will crash. Unlike errors, exceptions are situations that your code, when properly designed, can catch on the fly.
Exceptions are not as drastic as errors, even if the result for you, the developer, will be the same—that is, a non-working program. In this chapter, we are inviting you to make your programs crash by intentionally provoking exceptions that you will later learn how to catch (that is, handle) and avoid. Depending on how you develop the catch mechanism, you can decide whether to get your program to recover and continue operating or to gracefully end its execution with a human-readable error message.
- Mastering NetBeans
- Spring 5.0 By Example
- Linux核心技術從小白到大牛
- TypeScript圖形渲染實戰:基于WebGL的3D架構與實現
- 教孩子學編程:C++入門圖解
- FLL+WRO樂高機器人競賽教程:機械、巡線與PID
- The Complete Coding Interview Guide in Java
- Android玩家必備
- Clean Code in C#
- 大數據時代的企業升級之道(全3冊)
- Android 5從入門到精通
- 大象:Thinking in UML(第二版)
- Learning IBM Bluemix
- Learning C# by Developing Games with Unity 3D Beginner's Guide
- Mastering MeteorJS Application Development