【转】[Java] equals
Student s3 = null; Student s4 = null; System.out.println(s3 == s4); System.out.println(s3 != null && s3.equals(s4));
直接 s3.equals(s4) 会报错:java.lang.NullPointerException
Student s3 = null; Student s4 = null; System.out.println(s3 == s4); System.out.println(s3 != null && s3.equals(s4));
直接 s3.equals(s4) 会报错:java.lang.NullPointerException