how to check array with null in java code example
Example 1: isempty for arrays
int arr[] = null;
if (arr == null) {
System.out.println("array is null");
}
Example 2: isempty for arrays
Object arr[] = new Object[10];
boolean empty = true;
for (int i=0; i<arr.length; i++) {
if (arr[i] != null) {
empty = false;
break;
}
}