This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Just started doing it today and I ran into my first problem. I wrote the code but it has an error and I can't tell what it is. So if you could help me out that would be appreciated. Sorry if its super obvious.
Welcome to CodeRanch! I've edited your post to add code tags and make it look all pretty .
This line is suspect. Since x doesn't change, it would make for an infinite loop. You don't say what "has an error" means. What should we be looking for? Did you get a compiler error? Did it not print out what you expected?
Colton Herren wrote:when I run the program from the command prompt the words Big X continuously pop up like this
and on and on.
I need help with how to make it only pop up once.
If you want it to run only once, why are you using a loop? I loop is for when you want to do something multiple times (or potentially multiple times).
So, under what conditions (in English) do you want the loop to stop or to keep going? Or do you really want it to just go exactly once no matter what?
Glad it’s sorted, but it didn’t print Big X for ever after you put the increment in the loo. It printed Big X maybe 2147483637 times. If you had counted it, you would have seen.
It kept printing so long you thought it would never stop, but it would in fact have stopped eventually. After the addition of x = x + 1;, that is. Find out about x++; as shorthand for that line.
I see Jeff has already introduced you to x++[/edit]