Originally posted by mark stone:
compiler complains as following:
A.java:4: Missing term.
{return (throw new Exception());}
This statement makes no sense. You either return a value, or you throw an exception. You can't do both.
either return (something);
or throw (SomeException);
Originally posted by mark stone:
one more point since we are discussing this.
say an interface has one method. and i have a Class R that implements this interface. now in this class i am free to choose whatever throws i want. right ? i am asking because there are no such things when defining methods inside an interface.
you declare the throws clause in the interface when you make a method declaration. Then when you implement the method in a class, you must adhere to the interface's method declarations, including the throws clauses you have defined. So the answer to your second question is ,no
Rob
[ January 24, 2002: Message edited by: Rob Ross ]