-1

I keep getting this error in my program where I am calling the method getValWords and the error say the following "The method getValidWords(String) in the type anothertry is not applicable for the arguments (File)".

This is a sample of my code.

    File file = new File (args[0]);
    List<String> words = getValidWords(file);  
    Collections.sort(words);

    System.out.println(words.toString());

    }

public static String[] getValidWords(String s) {
    s = s.replaceAll("[0-9]\\p{L}+", " "); // Removes any word starting with a number
    s = s.replaceAll("\\s+", " "); // trims extra whitespace "    " into " "
    return s.split(" ");
}
markspace
  • 10,621
  • 3
  • 25
  • 39
Stanmoonie
  • 31
  • 5

1 Answers1

0

You must get file content first and convert to string then you call this method.