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

Introduction

Content

Apply

Reflect

Extend

previous.gif
 (3087 bytes)

next.gif
 (2959 bytes)


Extend Index

Extend Page # 9

Topic 1 — Why treat arithmetic and file not found exceptions differently?

In Java, FileNotFoundException is a subclass of Exception, which means that the program must catch that exception and do something about it. However, ArithmeticException is a subclass of RuntimeException, which means that the program need not handle it. It could be argued that there is no reason for ArithmeticException to be treated any differently from FileNotFoundExceptions.

What reasons might there be for the Java developers’ imposing this distinction?

Do you think the decision was a sensible one?

Back to top

 basicline.gif (169 bytes)

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