Covariant Return Types - J2SE 5.0

I just read the tech tip regarding the new covariant return types in j2se 5.0

In the doc, it said that you can now compile two methods with the same signature but with different return types. I was wondering if anyone knew how this would affect what the following expression returns: anObject.getClass().getMethod(aMethodNameString, aClassArray)

If there are two methods with the same signature except for the return type, how does the above expression know which method to return?

[501 byte] By [azkerbana] at [2007-9-30 23:38:56]
# 1

Never mind, I just found my answer in the javadoc....

"To find a matching method in a class C: If C declares exactly one public method with the specified name and exactly the same formal parameter types, that is the method reflected. If more than one such method is found in C, and one of these methods has a return type that is more specific than any of the others, that method is reflected; otherwise one of the methods is chosen arbitrarily. "

azkerbana at 2007-7-7 14:52:55 > top of Java-index,Administration Tools,Sun Connection...