这是工作代码。我知道比较equals更好,但是为什么在创建具有相同值的新Double时,它指的是内存中的不同位置,而Long却没有。
public class Main {
public static void main(String[] args) {
Long firstLong = 1L;
Long secondLong = 1L;
Double firstDouble = 1.0;
Double secondDouble = 1.0;
System.out.println(firstLong == secondLong);
System.out.println(firstDouble == secondDouble);
}
}

