Re: Input output file help
The first part is just making sure the user enters a 1 or 2. If the user enters something else, it will repeat the question.
As for the second part, read this: Lesson: Basic I/O (The Java™ Tutorials > Essential Classes)
Re: Input output file help
Shouldn't that be:
Code :
while (inputBad == true);
Or even shorter:
Re: Input output file help
Also, one other thing is that your if statement contains a null statement because you follow it immediately with a semicolon. If you want the next line of code to execute when the if condition is fulfullied, remove the semicolon.
Re: Input output file help
Quote:
Originally Posted by
mjpam
Also, one other thing is that your if statement contains a null statement because you follow it immediately with a semicolon. If you want the next line of code to execute when the if condition is fulfullied, remove the semicolon.
Good catch. Better yet, always use {} blocks for if statements and loops.