您的位置:寻梦网首页编程乐园Java天地Core JavaJava Lecture Notes

Introduction

Content

Apply

Reflect

Extend

previous.gif
 (3087 bytes)

next.gif
 (2959 bytes)


Content Index

Content Page # 36

Why exceptions get ignored ?

We have already seen that the programmer should not ignore exceptions. Why would they get ignored?

There are two main reasons:

  • The programmer does not anticipate that a particular method can go wrong

  • The programmer delays writing instructions to handle the exception, then forgets to do it later

File handling in particular is an area where a great many things can go wrong. It can be very time-consuming (and sometimes difficult) to write instructions that deal correctly with all the possible exceptions.

Java’s exception handling scheme is designed to make it difficult for the programmer to forget or ignore exception handling. Whenever an exception can occur, the programmer is forced to do something about it, even if it is only to write instructions to ignore it.

It is important to realize that good exception handling requires a lot of extra programming. In many cases, there may be as much or more code concerned with exception handling than with the normal operation of the program.

Back to top

basicline.gif (169 bytes)

RITSEC - Global Campus
Copyright ?1999 RITSEC- Middlesex University. All rights reserved.
webmaster@globalcampus.com.eg