Checking for invalid input
I am having a problems of detecting whether the user input is exist in the
txt file or not.
while((s = br.readLine()) != null) {
if (s.split(",")[1].containts(infoToRemove)) {
continue;
} else
JOptionPane.showMessageDialog(null, "ID is not exist",
"Error", JOptionPane.ERROR_MESSAGE);
wr.println(s);
}
This is working when the id does not exist, it will pop up the message.
However it will always pop up twice. How can I make it only pop up once?
No comments:
Post a Comment