The question give is:
x = 0
if(x1.hashCode() != x2.hashCode()) x = x +1
if(x3.equals(x4) == false) x = x+ 10;
if (x5.equals(x6) == true ) x = x + 100;
if (x7.hashCode() == x8.hashCode()) x = x + 1000
System.out.println("x = " + x)
If output is "x = 1111", which of following statements will always be true?
Answer given: x2.equals(x1)
Explaination: By Contract if two objects are equal then their hashcode must evaluate thenm to be ==
But, according to me, since o/p is 1111, all the above if condition will evaluate to true and hence x.hashCode() != x2.hashCode() which is contradicting the explaination.
Can someone tell me that whether there is an error of mock exam, or am I missing something important?