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(); ??
Post by:autobot
You ought to ventilate your mind and let the cobwebs out of it. Use this cup to catch the tiny ads:
a bit of art, as a gift, the permaculture playing cards