• Post Reply Bookmark Topic Watch Topic
  • New Topic

Usage of RuntimeException in our program

 
Venkatesh Rajendran
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Can we catch RuntimeException in our program? If we use,is there any performance issue? If it does not affect performance how to use it.Can any one explain me clearly.
Thanks in advance.
Venkat
 
Rahul Mahindrakar
Ranch Hand
Posts: 1869
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Venkatesh,
I dont think that RuntimeException affects performance. But catching it and logging it is helful for the maintaince to debug the problem that occured.
Lets say for some reason an ArrayIndexOutOfBoundsException took place in your code. If you dont catch this RuntimeException and log it how will you come to know what problem has occured.
BR
Rahul
 
Mike Brock
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rahul Mahindrakar:
Hi Venkatesh,
I dont think that RuntimeException affects performance. But catching it and logging it is helful for the maintaince to debug the problem that occured.
Lets say for some reason an ArrayIndexOutOfBoundsException took place in your code. If you dont catch this RuntimeException and log it how will you come to know what problem has occured.
BR
Rahul

Well you will certainly know that an ArrayIndexOutOfBoundsException has occured, since all uncaught RuntimeExceptions will cause the JVM to exit.
Mike.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!