China Naming Network - Ziwei Dou Shu - How does java read the names of all files in a folder?

How does java read the names of all files in a folder?

The public static void main(String[] args) throws an exception {

string dirPath = " E:/test file ";

File dir = new file (dirpath);

string[]sub filenames = dir . list();

If (sub file name! = null & amp& amp filename. & gt0){

For (string filename: filename) {

System.out.println (sub-file name);

}

}

}