Compare Arrays: null arrays are equal in Java
Description
The following code shows how to compare Arrays: null arrays are equal.
Example
/* w ww.j ava 2s . c o m*/
import java.util.Arrays;
public class Main {
public static void main(String[] argv) throws Exception {
boolean[] bArr1 = null;
boolean[] bArr2 = null;
boolean b = Arrays.equals(bArr1, bArr2); // true
System.out.println(b);
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »