- 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.
- 零基礎學Visual C++第3版
- C語言程序設計(第3版)
- Python網絡爬蟲從入門到實踐(第2版)
- Blender 3D Incredible Machines
- Python Data Analysis(Second Edition)
- Kinect for Windows SDK Programming Guide
- HTML5從入門到精通(第4版)
- D3.js By Example
- Java程序員面試筆試寶典(第2版)
- C語言程序設計實訓教程與水平考試指導
- 零基礎學C語言(升級版)
- .NET 4.0面向對象編程漫談:應用篇
- 30天學通C#項目案例開發
- AMP:Building Accelerated Mobile Pages
- STM8實戰