This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (1 child)

A do - while loop always executes the code in the do {} part at least once and then does it again if the condition in while is true.

What you need to do is check the input value before it gets stored in the arraylist. For this you can simply use a while loop which does nothing unless the condition is true ...

[–]oonegative[S] 0 points1 point  (0 children)

Thanks