Results 1 to 5 of 5
Thread: Firt letter with T
- 02-25-2011, 07:06 PM #1
Member
- Join Date
- Sep 2010
- Posts
- 61
- Rep Power
- 0
Firt letter with T
// Write the code, below, to reports to the console the first word
// in the "words" array list that, lexicographically
// (i.e. "in the dictionary"), that starts with the letter 't'
Any idea how to do this?
Java Code:import java.util.*; public class FirstWordWithT { public static void main(String [] args) { String [] text = {"on", "tuesday", "the", "little", "todder", "was", "tentatively", "testing", "his", "mother's", "patience"}; ArrayList<String> words = new ArrayList<String>(); for (String s : text) words.add(s); } }
- 02-25-2011, 07:43 PM #2
Senior Member
- Join Date
- Mar 2010
- Posts
- 953
- Rep Power
- 4
How would you do it if you weren't writing a program to do it? In other words, from that set of words, which is the first in lexicographical order that starts with "t"? How do you know?
By the way, "todder"? Don't you mean "toddler"?
-Gary-
- 02-25-2011, 07:44 PM #3
Member
- Join Date
- Sep 2010
- Posts
- 61
- Rep Power
- 0
If in know that I would not be asking.
- 02-25-2011, 08:23 PM #4
Senior Member
- Join Date
- Feb 2011
- Posts
- 118
- Rep Power
- 0
- 02-25-2011, 09:04 PM #5
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,545
- Rep Power
- 11
Similar Threads
-
[Q] Generate Random Letter
By iriscience in forum New To JavaReplies: 11Last Post: 01-31-2011, 12:10 AM -
Repeat a letter twice in java.
By ustar in forum New To JavaReplies: 3Last Post: 03-23-2010, 09:56 AM -
Letter view
By wide in forum NetBeansReplies: 1Last Post: 07-02-2009, 02:40 PM -
Printing Out Every Other Letter
By Agent in forum New To JavaReplies: 4Last Post: 11-20-2008, 12:43 AM -
Letter with Letters
By elgatoboricua in forum New To JavaReplies: 7Last Post: 09-16-2008, 02:59 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks