Results 1 to 2 of 2
- 02-09-2013, 03:28 PM #1Member
- Join Date
- Oct 2012
- Rep Power
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.
ArrayList<String> theList = new ArrayList<String>(); System.out.print("Type a message to sort: "); theList.add(console.nextLine());
- 02-09-2013, 03:45 PM #2
- By Psygnosys in forum New To JavaReplies: 4Last Post: 04-07-2012, 12:55 PM
- By ankit1801 in forum New To JavaReplies: 3Last Post: 03-23-2011, 11:07 AM
- By Muskar in forum Advanced JavaReplies: 12Last Post: 11-26-2010, 09:33 AM
- By albertkao in forum New To JavaReplies: 1Last Post: 11-04-2010, 07:53 PM
- By k4ff1n34dd1c7 in forum New To JavaReplies: 5Last Post: 03-23-2009, 06:10 PM