2,831   Java

1. 使用 equals 方法

        Long a = new Long(3);
        Long b = new Long(3);
        System.out.println(a.equals(b));

2. 使用 Long 类型中的 longValue() 方法进行比较,如

        Long a = new Long(3);
        Long b = new Long(3);
        System.out.println(a.longValue()==b.longValue());



Leave a Reply

Your email address will not be published. Required fields are marked *