This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes try within a try statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "try within a try statement" Watch "try within a try statement" New topic
Author

try within a try statement

Shrawan Bhageria
Ranch Hand

Joined: Jun 20, 2005
Posts: 52
hi all
pl. let me know
Is it possible to write a try within a try statement

thanks
shrawan

SCJP1.4,SCWCD1.4,MCP
SCBCD(preparing)
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Why don't you try it and find out?

Moving to Java in General (Beginner).


[Jess in Action][AskingGoodQuestions]
Casper Maxwell
Ranch Hand

Joined: Aug 04, 2005
Posts: 88
As far as i remember, it is possible. But i can't think any need for this.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18545
    
  40

Originally posted by Casper Casper:
As far as i remember, it is possible. But i can't think any need for this.


Yes it is possible... and the classic case is when you need to simply call sleep() and wait(), and don't mind returning early. You simply wrap it with a try-catch, and just continue. This is, of course, may be in another larger try block.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Mark Wuest
Ranch Hand

Joined: Jun 07, 2003
Posts: 88
Originally posted by Ernest Friedman-Hill:
Why don't you try it and find out?

(emphasis mine)

Groan!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: try within a try statement
 
Similar Threads
Exceptions ExamLab 6.0
exceptions????
Static Inner Class
Jsp--Applet
about finally