newpat
Apr 18th, 2007, 06:22 AM
char C='e';
C=JOptionPane.showInputDialog("A/B?").charAt(0);
switch(C)
{
case'A':case'a':
System.out.print("A");
break;
case'B':case'b':
System.out.print("B");
break;
default:
JOptionPane.showMessageDialog(null, "Please answerA/B.");
break;
}
But people enter AAA,BBB instead of A,B,and that is ok...But i dun want it
being happen...how to de this bug?
C=JOptionPane.showInputDialog("A/B?").charAt(0);
switch(C)
{
case'A':case'a':
System.out.print("A");
break;
case'B':case'b':
System.out.print("B");
break;
default:
JOptionPane.showMessageDialog(null, "Please answerA/B.");
break;
}
But people enter AAA,BBB instead of A,B,and that is ok...But i dun want it
being happen...how to de this bug?