File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

exception handling??

 
srikanth reddy
Ranch Hand
Posts: 252
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


here i thought that A and c are printed...
but not its compile error...
exception java.io.IOException is never thrown in the corresponding try block ...
i didnt get it ...
instead of java.io.IOException i kept java.lang.Exception it worked fine...
whats the concept behind this???
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IOException is a checked exception you are trying to catch it but it's not thrown so the compiler is smart and throws a compile time error. But this is not the case with the class Exception , even though it's not thrown explicitly , there are possibility of getting runtime exceptions like NullPointer hence it compiles
[ October 13, 2005: Message edited by: Srinivasa Raghavan ]
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic