aspose file tools*
The moose likes Java in General and the fly likes Checked exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Checked exception" Watch "Checked exception" New topic
Author

Checked exception

sparsh khandelwal
Ranch Hand

Joined: Dec 20, 2010
Posts: 74
what is the meaning of the line that checked exception can not forward in calling chain


[Thumbnail for ScreenShot002.jpg]

Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4753
    
    7

Please QuoteYourSources (←click) ... I have no idea what that's supposed to mean either.


Junilu - [How to Ask Questions] [How to Answer Questions]
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11419
    
  16

screenshots like that are VERY hard for some of us to read. Can you past the test into a post instead?


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
sparsh khandelwal
Ranch Hand

Joined: Dec 20, 2010
Posts: 74
here is the linklink
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14270
    
  21

With checked exceptions, you must either catch them, or explicitly specify that the method inside which the exception might be thrown, passes it on the the calling method, by using a throws clause in the method declaration.

For example, if you have a method that throws a checked exception such as IOException:

This will not compile, because the method does not catch the exception, and it also doesn't have a throws clause. You have to fix it, for example like this:

See The Catch or Specify Requirement.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39415
    
  28
I am getting déjà vu. Is that the same website we told you to avoid recently?
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Campbell Ritchie wrote:I am getting déjà vu. Is that the same website we told you to avoid recently?


Wow. Awful indeed. His two main points on that page, "By rule, unchecked/checked exceptions are/are not propagated," are nonsense. The rules for propagation are exactly the same for every exception: If it's not caught, it bubbles up to the next nearest enclosing try block. That's the runtime behavior of every exception. The compile-time catch-or-declare rule for checked exceptions is a separate issue from that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Checked exception