You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Abdelilah Khossan 78e9c1846c
CON-1881-Review-java-piscine-subjects-Fix-grammar-and-semantic-issues (#2102)
1 year ago
..
README.md CON-1881-Review-java-piscine-subjects-Fix-grammar-and-semantic-issues (#2102) 1 year ago

README.md

FileSearch

Instructions

Create a file FileSearch.java.

Write a function searchFile that returns the path of the file in parameter. You need to start searching from a folder named documents at the root of the current folder.
The file to search can be located inside nested subfolders.

Expected Functions

public class FileSearch {
    public static String searchFile(String fileName) {
        // your code here
    }
}

Usage

Here is a possible ExerciseRunner.java to test your function
import java.io.IOException;

public class ExerciseRunner {
    public static void main(String[] args) throws IOException {
        System.out.println(FileSearch.searchFile("file.txt"));
    }
}

Create the following arborescence :

\ documents
| --- file.csv
| --- \ rep
      | --- example.txt
      | --- file2.csv
      | --- file2.xml
      | --- \ directory33
            | --- file.txt
            | --- test.png
      | --- \ directory22
            | --- test.gif
| --- \ directory435
      | ---test33.xls
          

and its output :

$ javac *.java -d build
$ java -cp build ExerciseRunner 
document/rep/directory33/file.txt
$ 

Notions

File