Chapter 6 - Exceptions Flashcards Preview

JAVA 8 OCA > Chapter 6 - Exceptions > Flashcards

Flashcards in Chapter 6 - Exceptions Deck (15)
Loading flashcards...
1

Runtime exceptions are also known as?

Runtime exceptions are also known as Unchecked exceptions.

2

Is a Runtime exception a subclass of RuntimeException?

Yes.

3

Is a Checked exception a subclass RuntimeException?

No. It is a subclass of Exception but not a subclass of RuntimeException.

4

What is the subclass of the Error type?

Subclass Error is the subclass of the Error type.

5

Are run time exceptions okay for a program to catch?

Yes, this applies to Runtime exception ans Checked exceptions.

6

Is a program requiered to handle or declared runtime exceptions?

No.

7

Is a program requiered to handle or declared checked exceptions?

Yes.

8

Is a program requiered to handle or declared Error?

No.

9

Do try statements require curly braces?

Yes. Try statements must have curly braces even if there is just one statement inside the code block.

10

Is catch neede after a try statement?

Yes, try must be always acompanied by a catch, otherwise the code will not compile.

11

Can finally blocks be used as part of try statements?

Yes. A finally block can only appear as part of a try statement.

12

Do finally blocks execute even if an exception in the try block does nos occur?

Yes. The finally block always executes whether or not an exception occurs in the try block.

13

Do a try statement must have catch and/or finally statements?

A try statement can have both: catch or finally. Having both is ok. No having any of those is a problem.

14

What will happen with a finally block if the System.exit method is called in the try or catch block?

If the System.exit method is called in a try or catch block, finally does not run.

15

Which type of exception is thrown When a superclass exception is caught before a subclass exception?

A compiler error about unreachable code occurs.