Lecture 10 - Exceptions Flashcards

1
Q

Errors vs Exceptions

A

Errors are system errors, rare and difficult to repair.

Exceptions can/should be solved by programmer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Errors/Checked/Unchecked

A
  • Errors should generally not be caught. Represent irrecoverable situations.
  • Unchecked run-time exception should generally be caught, could be declared. Represent unexpected but recoverable situation.
  • Checked run-time exception must be declared and must be caught. Represent recoverable situations.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Syntax

A

There can be 0, 1 or more catch clauses since more than one exception type can be thrown or the exception is dealt with elsewhere.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Why create own Exception Class?

A

Being Specific so you can handle exceptions effectively.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Finally Clause

A

Optional, can be useful in cleaning up before the program terminates.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly