I am studying Java and I am not really sure the way to searching file. I would like to build the function which returning file names ( the files name should begin with st
st
Probably the easiest way is to simple use File#listFiles(FileFilter), something like
File[] fileList = new File("/path/to/search").listFiles(new FileFilter() { @Override public boolean accept(File pathname) { return pathname.getName().endsWith(".txt"); } });