You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
620 B
27 lines
620 B
package testdata;
|
|
|
|
public class TryCatchFinally {
|
|
|
|
public static void method() {
|
|
int count = 0;
|
|
try {
|
|
if (true) {
|
|
throw new NullPointerException();
|
|
}
|
|
throw new AssertionError();
|
|
} catch (IllegalStateException e) {
|
|
throw new AssertionError();
|
|
} catch (NullPointerException expected) {
|
|
count++;
|
|
} catch (RuntimeException e) {
|
|
throw new AssertionError();
|
|
} finally {
|
|
count++;
|
|
}
|
|
|
|
if (count != 2) {
|
|
throw new AssertionError();
|
|
}
|
|
}
|
|
}
|