Dear all,
Today I took an online quiz from a
Java platform product company I were confused by one of the questions.
What is the output of the following code fragment:
public MyClass {
int i;
public boolean equals(G g) {
return (this.i == g.i);
}
}
G g1 = new G(1);
G g2 = new G(1);
System.out.println(g1 == g2 + ", " + g1.equals(g2));
A false, false
B false, true
C true, false
D true, true
I thought there is no correct answer for the question. Because you don't know what G is and what MyClass is.
Am i right?
What do you think?
Thanx in advance.
[This message has been edited by Liu Zhensheng (edited June 28, 2001).]