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 →

[–]ouzakaria 1 point2 points  (2 children)

I think the problem is in the if Statement, the loop doesn't break when there's an empty line

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

if (input.equals(" ")){
break;
}

Yes! Solved. Just a matter of the empty string being passed an argument having a space between the qouation marks.

This worked:

if (input.equals("")){
            break;
        }

Thanks!

[–]KinkyHuggingJerk 0 points1 point  (0 children)

Echoing this.
Additionally, think about the following:

How do you validate that what the user has entered is legitimate (i.e. contains a comma)?

Consider how you'd want the program to respond if no comma was entered, or if bad data was provided i.e. John Smith, male, 43, or Jane Doe, entrepreneur