Results 1 to 3 of 3
  1. #1
    jwl
    jwl is offline Member
    Join Date
    Jul 2012
    Posts
    93
    Rep Power
    0

    Default Most efficient way to take out the letter s in a for loop?

    I want to say

    Java Code:
    if (i != 4) 
                             System.out.println("You have " + (numAttempts - 1 - i) 
                                                + " attempts left.");
    My problem is how can I use the word attempt without the "s" when there is only one attempt left? Do I have to create another if statement to say you have only one attempt left?

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,184
    Rep Power
    19

    Default Re: Most efficient way to take out the letter s in a for loop?

    See java.text.MessageFormat and java.text.ChoiceFormat

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    RichersooN is offline Senior Member
    Join Date
    Jan 2011
    Location
    Rizal Province, Philippiines
    Posts
    167
    Rep Power
    0

    Default Re: Most efficient way to take out the letter s in a for loop?

    if (i ==1) System.out.println("you only have one attempt left");

Similar Threads

  1. more efficient way to make this??? [LOOK]
    By Green in forum New To Java
    Replies: 10
    Last Post: 09-09-2011, 01:01 AM
  2. Tell me efficient way
    By lkalaivanan in forum New To Java
    Replies: 3
    Last Post: 08-11-2011, 11:36 AM
  3. Loop through all letter and number possibilities?
    By Mr.abe90 in forum New To Java
    Replies: 11
    Last Post: 05-29-2011, 07:47 PM
  4. is there a more efficient way?
    By Yakg in forum New To Java
    Replies: 3
    Last Post: 01-23-2011, 05:32 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
  •