Can we catch multiple exceptions in a single catch block in Java 7+?

  1. Yes, using pipe symbol (|)
  2. No, only one catch allowed
  3. Yes, using comma
  4. Only for runtime exceptions
Correct answer Yes, using pipe symbol (|)

Explanation

Java 7+ allows catching multiple exceptions using `catch (A | B e)` syntax.

Update: Admin added a tag on this question

Topics

By Admin · · 34 views