jQuery in Action, 2nd edition*
The moose likes Beginning Java and the fly likes The try block Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "The try block" Watch "The try block" New topic
Author

The try block

Vlada Den
Ranch Hand

Joined: Dec 19, 2004
Posts: 32
Hey!!

Is it possible to use try on a single statement?

Thanks,

Vlada
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4419
    
    5

Originally posted by Vlada Den:
Hey!!


Right back atcha!

Sure, it's possible.


Junilu - [How to Ask Questions] [How to Answer Questions]
Vlada Den
Ranch Hand

Joined: Dec 19, 2004
Posts: 32
Thank you , Junilu.

I've just tried it out and it worked. But in my texbook "Java 2: The Complete Reference" it says, that you can't use try on a single statement.

Vlada
Srinivasa Raghavan
Ranch Hand

Joined: Sep 28, 2004
Posts: 1228
I think you have misread something.
The book must have told you, that try cant be used alone without a catch or finally


Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: The try block
 
Similar Threads
Static, instance and local variables
RUNNING AN EXE THROUGH A JAVA PGM
What is the best approach to write result set data to flat file?
Inner class and static members
Another 'Y' game