JAVA IO - list files/direcotries

import java.io.File;


public class FileList {
    public static void main(String args[]){
    	File file = new File("c:\\work\\hello");
    	for(String str : file.list()){
    		System.out.println(str);
    	}
    	
    	for(File cfile : file.listFiles()){
    		System.out.println(cfile.getName());
    	}
    }
}



你可能感兴趣的:(java,IO,File)