wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Troubles with loop Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Troubles with loop" Watch "Troubles with loop" New topic
Author

Troubles with loop

Manuel Diaz
Ranch Hand

Joined: Apr 22, 2005
Posts: 79
Hi all, I have this code:



OK, What I mean here is, If the first number is greater than 7, then it has to start again until the user input a value less than 7. And the same for second number. This works fine, but when it finish, the program starts again, I want the program finish if the 1 number is < 7 and 2 number is < 7. I dont want the program keep going again and again. What can I do then?.

THANKS ALL IN ADVANCE
[ May 14, 2005: Message edited by: Mark Spritzler ]

Note: I love programming.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Well you "while" will continually run because it will always evaluate to true.

Here's a better way to write your code. There are other ways too.



Although what type of Object is the variable "c" set to, instead of just using System.out.println()?

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Manuel Diaz
Ranch Hand

Joined: Apr 22, 2005
Posts: 79
C is the console. Im programing on the console.

THANKS FOR YOUR HELP.
 
jQuery in Action, 2nd edition
 
subject: Troubles with loop
 
Similar Threads
Why This Error??
Compile issue -- misplaced construct error
What's wrong with my code?
help on Yahtzee
How can I do this?