File类的目录操作
package hanghao;
import java.io.File;
/*读取出目录中目录名或文件名(仅第一层子目录)
*/
public class Hanghao {
public static void main(String args[]) throws Exception{
File file=new File("F:\\eclipse-jee-mars-1-win32-x86_64"
+ "\\workspace\\jiekou");
if(file.isDirectory())
{
String[] names=file.list();
for(String name:names){
System.out.println(name);
}
}
}
}