Results 1 to 5 of 5
  1. #1
    globo is offline Member
    Join Date
    Sep 2010
    Posts
    61
    Rep Power
    0

    Default 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);
             
          
          
       }
    }

  2. #2
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    953
    Rep Power
    5

    Default

    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-

  3. #3
    globo is offline Member
    Join Date
    Sep 2010
    Posts
    61
    Rep Power
    0

    Default

    If in know that I would not be asking.

  4. #4
    NRitH is offline Senior Member
    Join Date
    Feb 2011
    Posts
    118
    Rep Power
    0

    Default

    Quote Originally Posted by globo View Post
    If in know that I would not be asking.
    You're kidding, right?

  5. #5
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,574
    Rep Power
    12

    Default

    Quote Originally Posted by NRitH View Post
    You're kidding, right?

    And it's not even Tuesday!

Similar Threads

  1. [Q] Generate Random Letter
    By iriscience in forum New To Java
    Replies: 11
    Last Post: 01-31-2011, 01:10 AM
  2. Repeat a letter twice in java.
    By ustar in forum New To Java
    Replies: 3
    Last Post: 03-23-2010, 10:56 AM
  3. Letter view
    By wide in forum NetBeans
    Replies: 1
    Last Post: 07-02-2009, 03:40 PM
  4. Printing Out Every Other Letter
    By Agent in forum New To Java
    Replies: 4
    Last Post: 11-20-2008, 01:43 AM
  5. Letter with Letters
    By elgatoboricua in forum New To Java
    Replies: 7
    Last Post: 09-16-2008, 03:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •