0

Hi guys :D..

just wondering.. when I'm using scanner this is the code I use to ignore the case
"to put in the do..while statement"

} while (choice.trim().equalsIgnoreCase("Y"));

I've been looking all over the net. what code should I use if I'm using JOption..
can anybody please help me on this??

inputString = JOptionPane.showInputDialog(null, "Do again? [Y/N]: ");
          choice = inputString.charAt(0);
} while (choice != 'N');

what code should i put in the green part??

Edited by Ashenvale: n/a

3
Contributors
7
Replies
9
Views
5 Years
Discussion Span
Last Post by thines01
0

} while (choice != 'N' || choice != 'n');

you mean like this?? @_@

0

sorry I'm still a beginner I feel kind of lost here.

Edited by Ashenvale: n/a

0
} while (choice != 'N' && choice != 'n');

:D ah wait, this one work. although I don't know if there are other ways to do it

0

Those will work as long as "choice" is a char. (or...)

} while (Character.toUpperCase(choice) != 'N');
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.