JDK源码详解之File

1. 类释义

2. 类方法

  • listFiles()
File[] 	listFiles()
Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname.

返回一个抽象路径名数组,该数组表示由该抽象路径名表示的目录中的文件。

  • list()
String[] 	list()
Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname.

返回一个字符串数组,这个数组的内容是由抽象路径名表示的目录中的文件以及文件夹。

3. 简单示例