Page 2 of 2 FirstFirst 12
Results 21 to 22 of 22
  1. #21
    angryboy's Avatar
    angryboy is offline Senior Member
    Join Date
    Jan 2009
    Posts
    742
    Rep Power
    6

    Default

    If you chain 3 of these, it'll work. And read the links chris provided.

    Java Code:
             GET                             
            USER                             
            INPUT  <--------------------     
              .                        |     
              |                        |     
              |                        |     
    +-------------------+              ,,    
    |                   |           ,'`  `.  
    |  while(condition) |          /       \ 
    |                   |-------->|  RETRY  |
    |    M OR F ?       |    false \       / 
    |                   |           '.   ,'  
    |                   |             ```    
    +--------/----------+                    
             |                               
             |                               
             |                               
             |                               
             | true                          
           ----                              
           NEXT                              
           ----
    USE CODE TAGS--> [CODE]...[/CODE]
    Get NotePad++ (free)

  2. #22
    mfaizan24 is offline Member
    Join Date
    Apr 2009
    Posts
    27
    Rep Power
    0

    Default

    I have change it to this

    if((age<=0) && (!g.matches("^[mMfF]$"))){
    System.out.println("Age and gender both are incorrect");
    System.out.println("need to enter all details again");
    continue;
    }else if(age<=0){
    System.out.println("age is less than or equal to 0");
    System.out.println("need to enter all details again");
    continue;
    } else if(!g.matches("^[mMfF]$")){
    System.out.println("Gender must be male or female other characters found");
    System.out.println("need to enter all details again");
    continue;
    }

    problem resolved thanks everyone thank you very much.
    :)

Page 2 of 2 FirstFirst 12

Similar Threads

  1. what code for not hitting enter?
    By tornbacchus in forum New To Java
    Replies: 4
    Last Post: 04-11-2009, 04:59 AM
  2. enter key problem
    By masa in forum AWT / Swing
    Replies: 3
    Last Post: 03-19-2009, 07:30 AM
  3. [SOLVED] User Input - loop
    By new person in forum New To Java
    Replies: 4
    Last Post: 02-22-2009, 10:02 PM
  4. loop when there is no user-input
    By becky in forum New To Java
    Replies: 12
    Last Post: 02-02-2009, 10:02 PM
  5. Replies: 2
    Last Post: 04-16-2008, 12:18 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
  •