newした2つのinstanceを比較する
Sample.java
public class Sample {
int i;
}
public static void main(String[] args) {
Sample s1 = new Sample();
Sample s2 = new Sample();
System.out.println(s1.equals(s2));
s1 = s2;
System.out.println(s1.equals(s2));
}
false
true