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

problrm with throw ing a exception but catching into a method declaring thorws

 
thirumala raju
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi folks,

void met()throws IOException
{
System.out.println("RRRRW");
throw IOException;
}

the above piece of code i have declared a method to throws the exception which is occuring in this method IOException.. bbut it is having compile error

raja
 
abhishek pendkay
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
your throw statement is not correct... when you use throw you actually throw a object of IOException (or any other exception you want to throw)...
the correct code would be

[ January 04, 2008: Message edited by: abhishek pendkay ]
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic