Technically, these two functions do have the same type (Object -- since all Strings are Objects). I'm not sure if I would use the same wording that you quoted. I would say that all methods should have return types that are directly related to each other (that is, each should be a sub-type or super-type of all the others).
Interesting question. I think you are correct. A reference type returned by an overriding method must be the same as, or a subtype of, the reference type returned by the overridden method. I suggest that you contact the author of the mock exam question.
Thanks for bringing this up Jimmy, and particularly for including the quesitonid. When I was first creating those questions I had overlooked that change to the JDK, and did not understand the use of the term covariant in the objecive 1.5 thus...
"Objective 1.5 Given a code example, determine if a method is correctly overriding or overloading another method, and identify legal return values (including covariant returns), for the method."
Do the questions on your free mock exams get randomly selected out of 320 questions or are they a fixed set of 60 questions??
Joined: Sep 14, 1999
They are from a pool of 60 question marked as guest questions from the total bank. However "every so often" I change those 60 questions so I get a bigger audience for feedback on my questions than purely those who have subscribed. I just checked and the total question count in the whole JDK 1.5 database is 334 at the moment and I have some more to add in the near future. However quality beats quantity so I try not to rush at it ....
I have been working pretty much full time on JDk 1.5 SCJP material for several months now...