I want to obtain list of the files or subdirectories in a directory in java. I am new in java programming, so please provide some kind of program related to it or any suggestions about it. Any help would be appreciated.
I want to obtain list of the files or subdirectories in a directory in java. I am new in java programming, so please provide some kind of program related to it or any suggestions about it. Any help would be appreciated.
The code given below help you to obtain list of files or subdirectories in directory.
Code:File directory = new File ("dirname"); String [] str = directory.list (); if (str == null) { } else { for (int i=0; i<str.length; i++) { String Fname = str[i]; } }
Bookmarks