import java.io.File;
public class DirIsNull {
public static void main(String[] args) {
File file = new File("/home/huanyu/Desktop");
String[] files = file.list();
/**
* 打印文件名称
*/
for (String f:files ) {
System.out.println(f+files.length);
}
/**
* 判断眼泪是否为空
*/
if (files.length>0){
System.out.println("目录不为空!");
}else {
System.out.println("目录为空!!");
}
}
}