11 - Exceptions Flashcards

1
Q

Errors and exceptions are objects that …

A

represent unusual or invalid processing.

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

Error represents an …

A

unrecoverable situation and should not be caught.

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

Three ways to deal with exceptions.

A
  • not handle the exception at all
  • handle the exception where it occurs,
  • handle the exception at another point in the program.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

call stack trace

A

The messages printed when an exception is thrown provides a method call stack trace.

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

try-catch statement

A

A try-catch statement identifies a block of statements that may thrown an exception.

  • each catch clause is called an exception handler
  • finally clause is executed wither the try block is exited normally or because of a thrown exception.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

If an exception is not caught and handled it?

A

it is propagated to the calling method.

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

A new exception is defined by deriving a…

A

new class from the Exception class or one of its decedents.

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

Checked exceptions must either …

A

be caught by a method or must be listed in the throws clause of any method that may throw or propagate it.

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

throws

A

throws clause is appended to the header of a method definition to formally acknowledge that the method will throw or propagate a particular exception if it occurs.

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

Unchecked exception requires …

A

throws clause

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

The only unchecked exceptions in Java are

A

objects of type RuntimeException or any of its decendents.

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

A stream is…

A

a sequential sequence of bytes; it can be used as a source of input or a destination for output.

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

Three public reference variables in the System class represent the standard I/O streams.

A
  • System.in = standard input stream
  • System.out = standard output stream.
  • System.err = standard error stream (output for error messages)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly