import java.io *;. public class OnlyExt implements FilenameFilter {String strExt; "." public OnlyExt (String strExt) {this.strExt = strExt;} public boolean accept (File fleDir, String strName) {return strName.endsWith ( strexT);}}
// Directory of .TXT files.import java.io *; class DirListOnly {public static void main (String [] args) {String strDirName =. "C: / winnt"; File f1 = new File (strDirName); FilenameFilter only = New OnLyext ("txt"); string s [] = f1.list (ONLY); for (int i = 0; i