This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

exception handling??

 
srikanth reddy
Ranch Hand
Posts: 252
  • 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
  • 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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic