what i found in the code that your test() method of Swim class is using throws statement. So to compile it either you remove throws statement or put try-catch block in the main method of testFish class and use throw statement in test() method's catch block. If you want your caller method shd take care of exception then use throw statement in test method.
anyone Correct me if i m wrong..
[ June 03, 2006: Message edited by: nitin pokhriyal ] [ June 03, 2006: Message edited by: nitin pokhriyal ]
throws is a clause, while throw is a keyword. They are used with the Handle or Declare rule which states that:
If you do not want to catch an exception that is thrown in your method, then you can use the throws clause in the declaration of the method in which the exceptions takes place, to let the class where the method call occured handle the exception. So, the rule of thumb is : if you are catching the exception and not throwing it again then you dont need to use the throws clause.
SCJP 1.4 85%
Look! I laid an egg! Why does it smell like that? Tiny ad, does this smell weird to you?