• 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:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Drawback of enclosing entire code in try catch block instead the required portion?

 
Ranch Hand
Posts: 1510
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is considered a good way to enclose only the required code in try catch ,instead of simple enclosing the entire code in it.What exactly is the reason and drawback with the latter approach ?

Thanks .
 
Marshal
Posts: 69809
277
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your methods should be short enough that you can readily enclose the whole code in a try anyway.
 
Monica Shiralkar
Ranch Hand
Posts: 1510
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Your methods should be short enough that you can readily enclose the whole code in a try anyway.



Thanks.
 
    Bookmark Topic Watch Topic
  • New Topic