1arr = new int[0];
2if (arr.length == 0) {
3 System.out.println("array is empty");
4}
5
1Object arr[] = new Object[10];
2boolean empty = true;
3for (Object ob : arr) {
4 if (ob != null) {
5 empty = false;
6 break;
7 }
8}
9
1int arr[] = null;
2if (arr == null) {
3 System.out.println("array is null");
4}
5
1Object arr[] = new Object[10];
2boolean empty = true;
3for (int i=0; i<arr.length; i++) {
4 if (arr[i] != null) {
5 empty = false;
6 break;
7 }
8}
9