Converting each word in a string to ArrayList<String> values
I got a selfcheck exercise saying "Write code to read a line of input from the user and print the words of that line in sorted order, without removing duplicates."
This is what I've tried, but obviously not working, as it just stores the whole string as one parameter in the arraylist, while it should store each word as an individual parameter in the arraylist.
How do I find a way to add each word I type in to the arraylist?
ArrayList<String> theList = new ArrayList<String>();
System.out.print("Type a message to sort: ");
Re: Converting each word in a string to ArrayList<String> values
Check the API for String, looking for methods that might be useful.