• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

exceptions:catch or specify requirement

 
Rajiv Chelsea
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


check this link
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hint:

- 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic