This is an example of a recursive method - if the File is a directory, the same method is called with the new File. This will end if either a File is a file or a directory is empty; then the next File will be searched.
That leaves the implementation of the contains method. You'll have to read in each line and check for presence until the word is found. Look for BufferedReader and its readLine method for reading the File. You can use String's indexOf method to check if the word is present.