One of the mock questions in the MasterExam allows these two implementations of equals() (I've commented out the first)
I agree with the commented out version, but aren't there values for rate and bal which would break the hashcode contract for the uncommented version - if rate=1 and bal=2 in one object and rate=2 and bal=1 in the other? That way, equals would return true but hashcode false, assuming code has a non-empty
string - or am I missing something?
Does anyone know if errata has been produced for MasterExams (from the Sierra and Bates CDROM)?
[ May 31, 2008: Message edited by: Colin Hillman ]