CH11 - Exceptions and Localization Flashcards

1
Q

Unchecked Exception

A

An unchecked exception is any exception that does not need to be declared or handled by the application code it is thrown.

Unchecked exceptions are often referred to as runtime exceptions.

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

Error

A

Error means something went so horribly wrong that your program should not attempt to recover from it.

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

Throwable

A

Throwable is that it’s the parent class of all exceptions, including the Error class.

While you can handle Throwable and Error exceptions, it is not recommended you do so in your app code.

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

Checked Exception

A

Subclass of Exception but not subclass of RuntimeException

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

Unchecked Exception

A

Subclass of RuntimeException

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

Overriding method with Exception

A

An overridden method may not declare any new or broader checked exceptions that the method it inherits.

An overridden method in a subclass is allowed to declare fewer exceptions than the superclass or interface.

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

try-with-resources

A

Only classes that implement the AutoCloseable interface can be used in a try-with-resources statement.

Inheriting AutoClosable requires implementing a compatible close() method

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

Closable

A

Closeable extends AutoClosable they are both supported in try-with-resources statements.

Difference Closeable’s close() method declares IOException, while AutoCloseable’s close() method declares Exception.

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

Scope of Try-With-Resources

A

The resources created in the try clause are in scope only within the try block.

This is anoter way to remember that the implicit finally runs before any catch/finally blocks that you code yourself.

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