Multiple choice technology programming languages

Both class Error and class Exception are children of this parent:

  1. Throwable

  2. Catchable

  3. Runable

  4. Problem

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

To solve this question, the user needs to know the hierarchy of Java exceptions and errors.

Both class Error and class Exception are children of the parent class Throwable. This means that any class that extends Throwable can be used to represent an error or an exception that occurs during the execution of a Java program.

Option A is correct because Throwable is the parent class of both Error and Exception.

Option B is incorrect because there is no class called Catchable in Java.

Option C is incorrect because Runnable is an interface in Java, not a class that represents an error or an exception.

Option D is incorrect because there is no class called Problem in Java that represents an error or an exception.

Therefore, the answer is: A

AI explanation

In Java, Throwable is the root class of the exception hierarchy, and both Error and Exception directly extend it. Catchable, Runable, and Problem are not real classes in the Java class hierarchy.