Which statements about the following classes are true?
public class Exception1 extends Exception {} public class Exception2 extends Exception1 {} public class Exception3 extends IOException {} public class Exception4 extends IllegalStateException {} public class Exception5 extends Throwable {}
B.
First off, a class must inherit from RuntimeException or Error to be considered an unchecked exception.
Exception2 and Exception1 both are subclasses of Exception, but not RuntimeException, making them both checked exceptions.
Since IOException is a checked exception, the subclass Exception3 is also a checked exception.
Exception4 extends IllegalStateException, which is an unchecked exception that extends RuntimeException.
Finally, Exception5 extends Throwable, which does not inherit RuntimeException or Error, making it a checked exception.
Therefore, there are a total of four checked exceptions and one unchecked exception within the classes listed here.
Since there are no compilation errors in any of the class declarations, Option B is the correct answer, with the first and third statement being true.