GeeCON Prague 2014*
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


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: 4474
    
    6

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
 
GeeCON Prague 2014
 
subject: The try block