Hello! I am a beginner!I have a task to sort sentences by its word quantity, that is in Arraylist.For example,here is the code of my Array example:
List<String> numberOfWords=new ArrayList<>();
numberOfWords.add("Happy coding!"); //2 words or 3 with(!),I don't know
numberOfWords.add("He plays football in the playground everyday"); //7
numberOfWords.add("She is cooking an omellette"); //5
numberOfWords.add("I am coding in Java"); //5
numberOfWords.add("I want to code very well"); //6
// And the result must be like this: So, please could anyone give me some advice on how to come to this outcome??? Thanks!!!
Happy coding! //2 words
I am coding in Java //5 words
She is cooking an omellette //5words
I want to code very well //6 words
He plays football in the playground everyday //7words