java check if array is null or empty code example
Example 1: isempty for arrays
Object arr[] = new Object[10];
boolean empty = true;
for (Object ob : arr) {
if (ob != null) {
empty = false;
break;
}
}
Example 2: isempty for arrays
int arr[] = null;
if (arr == null) {
System.out.println("array is null");
}