am working on a project to write a program that finds 10 most used words in a text, but i got stuck dont know what i should do next can someone help me please.
i come this far only
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.regex.Pattern;
public class Lab4 {
public static void main(String[] args) throws FileNotFoundException {
Scanner file = new Scanner(new File("text.txt")).useDelimiter("[^a-zA-Z]+");
List<String> words = new ArrayList<String>();
while (file.hasNext()){
String tx = file.next();
// String x = file.next().toLowerCase();
words.add(tx);
}
Collections.sort(words);
// System.out.println(words);
}
}