Which of the following is a checked exception?
A. ClassCastException
B. IOException
C. ArrayIndexOutOfBoundsException
D. IllegalArgumentException
Answer:
B. IOException
Explanation:
ClassCastException, ArrayIndexOutOfBoundsException, and IllegalArgumentException are unchecked exceptions and can be thrown at any time.
IOException is a checked exception that must be handled or declared when used, making Option B the correct answer.