Question: Consider the following implementation of a hashCode ( ) method that uses the bitwise exclusive - or ( ^ ) operator. public class Point 2

Consider the following implementation of a hashCode() method that uses the bitwise exclusive-or (^) operator.
public class Point2D {
Double x, y;
...
public int hashCode(){
return x.hashCode()^ y.hashCode();
}
}
Which of the following statements are true about two instances p and q of a Point2D?
Question 9 options:
a)
if p.x q.y or p.y q.x then p.hashCode() q.hashCode()
b)
if p.x = p.y then p.hashCode()=0
c)
if p.x = q.y and p.y = q.x then p.hashCode()= q.hashCode()
d)
Both (a) and (b) are true
e)
Both (b) and (c) are true

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!