0

I am aware of the Checked and Unchecked Exception in Java.

In a multi-tiered environment, does unchecked Exception has a better performance over checked Exception?

SyntaX
  • 2,090
  • 17
  • 30

1 Answers1

2

There is absolutely zero performance difference. They're both just Exceptions.

Checked-/unchecked-ness is purely a compile-time concept.

Andy Turner
  • 137,514
  • 11
  • 162
  • 243
  • is unchecked exception " compile-time concept" ?? – Rahman Nov 15 '15 at 05:18
  • As far as I can see, [11.3. Run-Time Handling of an Exception](https://docs.oracle.com/javase/specs/jls/se7/html/jls-11.html#jls-11.3) draws no distinction between unchecked and checked exceptions - it doesn't even mention the terms. – Andy Turner Nov 15 '15 at 05:22
  • @Rehman A checked exception is verified by the compiler to be either caught (`try-catch`) or listed in the `throws` clause of the method. There is no run-time check for that. See "[Compile-Time Checking of Exceptions](https://docs.oracle.com/javase/specs/jls/se7/html/jls-11.html#jls-11.2)" and "[Run-Time Handling of an Exception](https://docs.oracle.com/javase/specs/jls/se7/html/jls-11.html#jls-11.3)" in the JLS. Therefore, the *difference* between checked and unchecked is a compile-time concept. – Andreas Nov 15 '15 at 05:28
  • Thanks all for the answer. :-) – SyntaX Nov 27 '15 at 16:05