Thursday, March 14, 2013

Java Class to Listing All File names in a Specific Folder

import java.io.File;


public class Filesamp {
public static void main(String a[])
{
File myFolder = new File("C:/Users/kiran/Desktop/work");
File afile[];
intj = (afile = myFolder.listFiles()).length;
for(int i = 0; i < j; i++)
{
File fileEntry = afile[i];
String fileName = fileEntry.getName();
System.out.println(fileName);
        
        
    }
}
}

1 comment:

  1. You can get step by step detail for any java related question.pl visit http://guruzon.com/1/oop-concepts and start with basics oop concepts

    ReplyDelete