0
Fill in the blanks to check whether the two objects of type A are semantically equal.
class A { private int x; public ____ equals(Object o) { ___ ((A)o).x == this.x; } public static void main(String[ ] args) { A a = new A(); a.x = 9; A b = new _____ (); b.x = 5; System.out.println(a. ____(b)); } } ===================================================================== new , x , b , boolean , A , return , equals =====================================================================
7 Answers
+ 7
boolean
return
A
equals
+ 1
boolean
return
A
equals
+ 1
Drag and drop from the options below to check whether the two objects of type A are semantically equal.
class A {
private int x;
public equals(Object o) {
((A)o).x == this.x;
}
public static void main(String[ ] args) {
A a = new A();
a.x = 9;
A b = new ();
b.x = 5;
System.out.println(a.(b));
}
}
0
class A {
private int x;
public boolean equals(Object o) {
return ((A)o).x == this.x;
}
public static void main(String[ ] args) {
A a = new A();
a.x = 9;
A b = new A();
b.x = 5;
System.out.println(a.equals(b));
}
}
0
boolen
return
A
equal
0
boolean
return
A
equals
0
boolean
return
A
equals