aspose file tools*
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
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: 17250
    
    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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Troubles with loop