File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes problrm with throw ing a exception but catching into a method declaring thorws 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 » Beginning Java
Bookmark "problrm with throw ing a exception but catching into a method declaring thorws" Watch "problrm with throw ing a exception but catching into a method declaring thorws" New topic
Author

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

thirumala raju
Greenhorn

Joined: Jan 03, 2008
Posts: 9
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

Joined: Jan 01, 2007
Posts: 184
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 ]

The significant problems we face cannot be solved by the same level of thinking which created them – Einstein
SCJP 1.5, SCWCD, SCBCD in the making
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problrm with throw ing a exception but catching into a method declaring thorws