aspose file tools
The moose likes Beginning Java and the fly likes Checked Exception in static method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Groovy Fundamentals video training course this week in the Groovy forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Checked Exception in static method" Watch "Checked Exception in static method" New topic

Checked Exception in static method

rahul deo

Joined: Jul 05, 2011
Posts: 10
Hi All

Can we throw a checked exception in a static method? I am confused , because till now i know that We can throws only a runtime exception. So if we can throw a checked exception then why and how? Thanks in advance
Rajdeep Biswas
Ranch Hand

Joined: Mar 26, 2012
Posts: 187

I'd recommend you to try to do so. Compiler will let you know, else you can see the behavior during execution. Then you can post here what you found!

The biggest gamble will be to ask a question whose answer you know in that it will challenge your theory |
Paul Clapham

Joined: Oct 14, 2005
Posts: 19553

Sure you can. It makes no difference whether the method is static or not, the same rules apply in both cases.
It is sorta covered in the JavaRanch Style Guide.
subject: Checked Exception in static method