Zero length Array

Assuming you mean in Java, you can iterate over zero-length arrays without any problem. However, you can't do this, if the variable is set to null.

String[] myArr = new String[0];
for (String str : myArr) {
  // do something here
}

If you set myArr to null instead, you'd get a NullPointerException in this loop.

你可能感兴趣的:(Zero length Array)