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(" ");
}