Hello sun,
I wanted to thankyou personally for your excellent work in developing those mock exams
Truely remarkable and challenging !!!
I managed to score 80% on your Mock3 (lotsa silly mistakes:-(
But it was really worth the time.
I have one question from the
test ***********************************
public class T025 {
private
String name;
T025(String name) { this.name = name; }
public static void main(String args[])
{
T025 t1 = new T025("one");
T025 t2 = new T025("two");
T025 t3 = new T025("two");
System.out.println(t1 == t2);
System.out.println(t2 == t3);
System.out.println(t2.equals(t3));
}
public int hashCode() {
return name.hashCode();
}
public boolean equals(Object o)
{
if(o == null | | !(o instanceof T025))
return false;
T025 other = (T025)o;
return this.name.equals(other.name);
}
}
I didnt quiet follow the explanation from the answer key
It seems to me this code makes a recursive call to the equal method.
Can anybody explain to me
Why the answer is
false
false
true
Thankx
Ragu
PS: Sun Keep up your good Work!!!