🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Java Exception Handling: all 10 questions

Quiz: Java Exception Handling · Question 4 of 10

Which order of catch blocks compiles?

Which order of catch blocks compiles?

  1. A.catch (ArithmeticException e) then catch (Exception e)
  2. B.catch (Exception e) then catch (ArithmeticException e)
  3. C.Both orders compile
  4. D.Neither compiles
Answer & explanation

Correct answer: catch (ArithmeticException e) then catch (Exception e)

A general catch first would make the specific one unreachable, which is a compile error.

Can you get the rest right without peeking?

Take the timed Quiz: Java Exception Handling quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →