Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Usage of RuntimeException in our program  RSS feed

 
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
 
Ranch Hand
Posts: 1871
  • 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
 
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!