This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Can you have a try/catch inside a try  RSS feed

 
Robert Johnson
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you have a try and catch inside a try block

???
 
Shailesh Chandra
Ranch Hand
Posts: 1084
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
answer is yes.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or inside a catch block or a finally block. You can do pretty much anything inside one set of curly braces that you could do inside any other set of curly braces.

Too much nesting gets messy and hard to read, so it's probably a hint that you should pull the nested bits out to their own methods.
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Too much nesting gets messy and hard to read, so it's probably a hint that you should pull the nested bits out to their own methods.


EXACTLY. Sorry to yell that.

Mark
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!