close
We can use File class to open a folder and read the file name of this folder.
and the method , list() , will return an array of strings naming the files in the directory.
File dir = new File("folder name");
String[] children = dir.list();
if (children ==null)
{
System.out.println("There is no file in this directory");
}
else
{
for(int i=0 ; i<children.length ; i++)
{
System.out.println(children[i]);
}
}
全站熱搜
留言列表