



| In pseudocode
the above method is expressed as follows: |
|
| public void
directoryListing( File dir ) |
|
| { |
|
| //assumption: dir represents a directory |
|
| fileList = an array of names of files and |
|
| subdirectories in the directory dir; |
|
| for (each element in fileList) { |
|
| if (an element is a file) { |
|
| output the element’s filename; //end case: it’s
//a file. |
|
| } |
|
| else { //recursive case: it’s a directory |
|
| call directoryListing with element as
an argument; |
|
| } |
|
| } |
|
| } |