import java.io.*;
class OnlyExt1 implements FilenameFilter
{
String ext;
public OnlyExt1(String ext)
{
this.ext = "." + ext;
}
public boolean accept(File dir, String name)
{
return name.endsWith(ext);
}
}
class DirListOnly
{
public static void main(String args[])
{
String dirname = "C:\\Program Files\\Java\\jre1.6.0";
File f1 = new File(dirname);
FilenameFilter only = new OnlyExt1("html");
String s[] = f1.list(only);
for (int i=0; i < s.length; i++)
{
System.out.println(s[i]);
}
}
}