The ques is
Which statements are true?
a. Assertions should never be placed at any point in the code that should not be reached under normal circumstances.
b. The compiler will generate an error if an assert statement is "unreachable" as defined by the
Java Language Specification.
c. A catch clause should not be used to catch an AssertionError.
d. AssertionError is a checked exception.
The ans given are b,c.
I tried to execute the following piece of code.
class b {
public static void main (
String[] args) {
try
{
System.out.println("hello world");
throw new AssertionError();
}
catch(AssertionError e)
{
System.out.println("catch");
}
finally
{
System.out.println("finally");
}
}}
The code did not give any compiler error. How should I interpret option c)?