why does the following code can not compile? public void amethod()throws IOException{ throw new ProtocolException(); } can can a method throws Excepton? like this: public void amethod()throws Exception
Hi There: I guess error is because amethod declaration says that it can throw one kind of exception while it actually throws another kind in the method body...
What is the error message you get when compiling your class? Something like unreported exception ProtocolException; must be caught or declared to be thrown throw new ProtocolException(); ??