1

Does throwing exceptions degrade the performance of an application? Is it possible to trace the performance [Resource utilization] to determine this?

At any case, does an exception terminate the execution of the following statements? I want to know all the technical aspects behind "throws" exception.

public someMethod() throws Exception {
 // raises exception here

 // safe code
}

Thanks in advance!

newfurniturey
  • 37,556
  • 9
  • 94
  • 102
zumit
  • 189
  • 1
  • 9
  • When you throw an Exception the whole stack of method calls is returned, which definitely means that throwing an exception is more resource demanding rather than returning a default value (like -1). – Pphoenix Jul 09 '14 at 12:21
  • 13
    Exceptions are exceptional. You should not focus your optimization efforts on exceptional cases. In fact, you should not even optimize until you have a performance problem. – JB Nizet Jul 09 '14 at 12:21
  • throws say that you don't want to handle Exception here and forced to caller to take care exception ,means at the end point all exception need to catch either by caller or jvm..It might affect performance but not always it depends upon how you coded – Abhishek Mishra Jul 09 '14 at 12:34

0 Answers0