• 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