I have developed an application that reads files from the folder chosen by the user. It displays how many lines of code are in each file. I want only Java files to be shown in t
You need a FilenameFilter. This should work for you:
FilenameFilter javaFileFilter= new FilenameFilter() { @Override public boolean accept(File logDir, String name) { return name.endsWith(".java") } };