摘要
Java程序运行期间发生的错误称为异常.异常产生后,应有相应的异常处理机制来捕获异常或抛出异常。JDK平台为我们提供了丰富和完整的异常类,通过它们来处理程序运行中的错误,防止错误对程序造成影响,确保程序能够安全运行。当这些异常类不能捕获实际应用中的异常时.就需要用户自定义异常。异常处理和用户自定义异常的正确与灵活运用:将有效地增强程序的交互性。增加程序的完整性。
The error occured during the Java program names exception. When it happens, there should be a corresponding exception handling mechanism to capture the exception or throw out it. JDK platform provides us with a rich and complete exception classes, through which we can deal with the error during the running of programs, in order to prevent the effect made by the error. Then the program can run safely. When these exception classes can not capture the exception in the practical application, it needs us to define the exception by 9urselves. The same as exception handling ,the accurately and flexiblely using of user-de.fined exception will effectively enhance the interactiveness and the integrity of the program.
作者
笪林梅
DA Lin-mei (Jiangsu Vocational and Technical College of Finance & Economics, Huai'an 223003, China)
出处
《电脑知识与技术》
2010年第02Z期1123-1125,共3页
Computer Knowledge and Technology
关键词
异常
捕获
抛出
异常类
自定义异常
exception
capture the exception
throw out the exception
exception classes
user-defined exception