The following java code, which outputs false:
class Value {
int i;
}
public class EqualsMethod2 {
public static void main(String[] args) {
Value v1 = new Value();
Value v2 = new Value();
v1.i = v2.i = 100;
System.out.println(v1.equals(v2));
}
}
Why isn't the result true instead? While reading some Java documentation I've found the following answer: the default behavior of equals() is to compare handles. But aren't v1 and v2 handles?
Thank you in advance.