Files!=null&files.length () is often used when judging non-empty >0 so many people wonder if the length equals 0 is empty?
To speak concisely:
Array initialization is summed up to two kinds:
null pointer: array =null Empty, is really empty, even the address is not assigned
null value: array ={}; There is no content, but there is space allocated, length 0, with address
public class Testarray {public
static void Main (string[] args) {
//"Null initialization does not assign address"
//Use statement array must be initialized with NULL initialization , the JVM does not assign an address
//array to array A. ToString () returns the hash value of the address, so a.tostring () does not exist.
//a.length does not exist. Will error
string[] A = null;
"Blank initialization length=0 but assigning addresses"
//So there will be all the features of the array b.length=0; B.tostring () =[ljava.lang.string;@7150bd4d;
String[] b={};
System.out.println ("A has no address so there is no length address attribute can only be used to determine whether it is empty:");
SYSTEM.OUT.PRINTLN ("* * * a==null results are:" + (A==null));
System.out.println ("B without content but with address so have length address attribute");
SYSTEM.OUT.PRINTLN ("* * * Length:" +b.length+ " B's Address:" +b.tostring ());
}