When comparing Object arrays, null elements are equal. If the elements are not null, Object.equals() is used. : Arrays « Collections Data Structure « Java
When comparing Object arrays, null elements are equal. If the elements are not null, Object.equals() is used.
import java.util.Arrays;
public class Main { public static void main(String[] argv) throws Exception {
boolean b = Arrays.equals(new String[] { "a" }, new String[] { "a" });
b = Arrays.equals(new String[] { null }, new String[] { null });
b = Arrays.equals(new String[] { "a" }, new String[] { null });
}
}