When a class implements a method, it is allowed to narrow the exception specification -- it's perfectly acceptable for an implementation of clone() to declare that it throws no exceptions. I don't recall the JLS stating explicitly that the implementations of clone() in the array classes had empty exception specifications -- but if you think about it, it makes obvious sense.
Yes Ernest, it does make sense if the implementation of array classes do not throw this exception. Well, thanks for your response. Regards Harwinder
Joined: Oct 17, 2003
Ernest I found supporting evidence for what you said. This is an excerpt from the JLS:
10.7 Array Members The members of an array type are all of the following: 1. The public final field length, which contains the number of components of the array (length may be positive or zero) 2. The public method clone, which overrides the method of the same name in class Object and throws no checked exceptions 3. All the members inherited from class Object; the only method of Object that is not inherited is its clone method