Exceptions Flashcards

1
Q

Exception

A

an exception is an event that alters program flow

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

RuntimeException

A

Runtime exceptions tend to be unexpected but not necessarily fatal.

For example, accessing an invalid array index is unexpected.
Runtime exceptions are also known as unchecked exceptions.

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

Checked exception

A

A checked exception includes Exception and all subclasses that do not extend RuntimeException.

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

Runtime Exceptions

A
ArithmeticException
ArrayIndexOutOfBoundsException
ClassCastException
IllegalArgumentException
NullPointerException
NumberFormatException
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Checked Exceptions

A

FileNotFoundException

IOException

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

Errors

A

ExceptionInInitializerError
StackOverflowError
NoClassDefFoundError

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

ArithmeticException

A

Thrown by the JVM when code attempts to divide by zero

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

ArrayIndexOutOfBoundsException

A

Thrown by the JVM when code uses an illegal

index to access an array

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

ClassCastException

A

Thrown by the JVM when an attempt is made to cast an exception to a subclass of which it is not an instance

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

IllegalArgumentException

A

Thrown by the programmer to indicate that a method has been passed an illegal or inappropriate argument

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

NullPointerException

A

Thrown by the JVM when there is a null reference where an object is required

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

NumberFormatException

A

Thrown by the programmer when an attempt is made to convert a string to a numeric type but the string doesn’t have an appropriate format

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

FileNotFoundException

A

Thrown programmatically when code tries to reference a file that does not exist

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

IOException

A

Thrown programmatically when there’s a problem reading or writing a file

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

ExceptionInInitializerError

A

Thrown by the JVM when a static initializer throws

an exception and doesn’t handle it

17
Q

StackOverflowError

A

Thrown by the JVM when a method calls itself too many times (this is called infnite recursion because the method typically calls itself without end)

18
Q

NoClassDefFoundError

A

Thrown by the JVM when a class that the code uses is available at compile time but not runtime