This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes exceptions:catch or specify requirement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "exceptions:catch or specify requirement" Watch "exceptions:catch or specify requirement" New topic

exceptions:catch or specify requirement

Rajiv Chelsea
Ranch Hand

Joined: Jun 15, 2010
Posts: 88
Quoting from Sun doc

"Code that fails to honor the Catch or Specify Requirement will not compile. "

Please help me with some code examples illustrating the same..
Sridhar Santhanakrishnan
Ranch Hand

Joined: Mar 20, 2007
Posts: 317

check this link
marc weber

Joined: Aug 31, 2004
Posts: 11343

Sridhar Santhanakrishnan wrote:

check this link

...which, ironically, is where the original poster seems to be quoting from.

Rajiv, have you tried to write your own examples based on what that article tells you?

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
David Newton

Joined: Sep 29, 2008
Posts: 12617


- A try statement that catches the exception. The try must provide a handler for the exception, as described in Catching and Handling Exceptions.
- A method that specifies that it can throw the exception. The method must provide a throws clause that lists the exception, as described in Specifying the Exceptions Thrown by a Method.
I agree. Here's the link:
subject: exceptions:catch or specify requirement