Exception Handling - University of Southern California
[Pages:31]Exception Handling
? General idea ? Checked vs. unchecked exceptions
? unchecked example: checking preconditions
? Semantics of . . .
? throws ? try-catch
? Example from text: DataAnalyzer ? Time permitting: Comparator problem
Exceptions [Bono]
1
Announcements
? Lab this week is based on the textbook example we'll discuss today.
? MT 2 sample exams have been published (some material is stuff we haven't covered yet)
Exceptions [Bono]
2
Lecture references
? Big Java ? Core Java, Volume I, 8th Ed, by Horstmann
and Cornell, Prentice Hall, 2008
Exceptions [Bono]
3
Exception handling
? Mechanism to help make bullet-proof programs:
? Desirable for our apps to be able to deal with any kind of external error. Examples:
? bad user input ? bad file formats ? missing files ? failed database connection
Exceptions [Bono]
4
Errors and recovery options
? Suppose an error occurs while our program is running.
? Good program responses:
? Report the error and... ? return to safe state and allow user execute other
commands ? or allow user to save all work and and terminate
program gracefully
? Not so good program responses:
? program crashes ? program is mum about the error
Exceptions [Bono]
5
Exception handling idea
? Allows us to separate point of error detection from point of error recovery
? First, an example to refer to in our discussions...
Exceptions [Bono]
6
Textbook example
? Code is in Section 11.5
? Problem:
? read in a bunch of data from a file with a specific format and process the data (computes the sum)
? Example file in1 (first line is number of values):
3 1.45 -2.1 0.05
Exceptions [Bono]
7
Possible user problems with data for DataAnalyzer example
Example file in1 (first line is number of values):
3 1.45 -2.1 0.05
Exceptions [Bono]
8
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- exceptions and assertions university of washington
- math 246 unit 7 exception handling in python
- python exceptions
- python exceptions i handling i online tutorials library
- controlling trace32 via python 3 lauterbach
- chapter 9 dealing with errors in python oxford university press
- exception handling
- beginners python cheat sheet pcc files exceptions
- 05b exceptions university of washington
- exception handling university of southern california
Related searches
- southern california universities
- southern california writers conference 2020
- university of california essay prompts
- southern california writers conference
- southern california writers conference 2019
- southern california christian writers conference
- university of california supplemental essays
- southern california community colleges list
- university of california free tuition
- university of california campuses
- university of california online certificates
- address university of california irvine