Results 21 to 22 of 22
- 06-10-2009, 11:24 PM #21
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)
- 06-11-2009, 02:18 AM #22
Member
- Join Date
- Apr 2009
- Posts
- 27
- Rep Power
- 0
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.
:)
Similar Threads
-
what code for not hitting enter?
By tornbacchus in forum New To JavaReplies: 4Last Post: 04-11-2009, 04:59 AM -
enter key problem
By masa in forum AWT / SwingReplies: 3Last Post: 03-19-2009, 07:30 AM -
[SOLVED] User Input - loop
By new person in forum New To JavaReplies: 4Last Post: 02-22-2009, 10:02 PM -
loop when there is no user-input
By becky in forum New To JavaReplies: 12Last Post: 02-02-2009, 10:02 PM -
How do check I allow user to enter only alpha numeric and -?
By tanalyw in forum New To JavaReplies: 2Last Post: 04-16-2008, 12:18 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks