9.1.9.File: String[] list() Returns an array of the files and directories within the File instance.
import java.io.File; public class MainClass{ public static void main(String[] argv){
File file = new File("c:\\");
String[] fileNames = file.list(); for(String s: fileNames){
System.out.println(s);
}
}
}
AUTOEXEC.BAT
boot.ini
CONFIG.SYS
Documents and Settings
found.000
g
IO.SYS
Java_Dev
MSDOS.SYS
NTDETECT.COM
ntldr
pagefile.sys
Program Files
RECYCLER
site
System Volume Information
WINDOWS