Yes, that should work. Except for the case that the user has entered more than one number on a line before hitting Enter. But the current code already has that problem so there wouldn't be any...
Type: Posts; User: Norm
Yes, that should work. Except for the case that the user has entered more than one number on a line before hitting Enter. But the current code already has that problem so there wouldn't be any...
Look at the condition that will end the loop. When is the value of count changed?
If the Scanner has an invalid value (say hasNext... is false), it will keep that value until some next method...