日期:2014-05-20 浏览次数:20763 次
import java.io.File; import java.io.FilenameFilter; public class Filter implements FilenameFilter { @Override public boolean accept(File dir, String filename) { // TODO Auto-generated method stub return filename.endsWith(".java"); } } 然后 File filelist = new File("d:\work"); String[] dirs = filelist.list(new Filter()); 取到后随便你放到什么地方