Questions
Please write a program to list all files in a directory and all its subdirectories, and this program should ask the user to type in a directory name; if the name entered by the user is not a directory, the program ends with an error message printed out.
1. Codes
1 | import java.io.File; |
2. Outputs
1 | --------->Enter a directory name: |