Re: Char type Comparisson
Your logic is flawwed... You're asking grad to be 'A', 'B', 'C', 'D', and 'F' at the same time, which it can't.
Switch the exclusive or logic to exclusive and (&&)
Re: Char type Comparisson
thank you now its working fine...wonderful
here the new code
Code :
import javax.swing.JOptionPane;
public class test
{
public static void main(String[] args)
{
String strnGrade = JOptionPane.showInputDialog("Enter the Grade for the course ");
char grad = strnGrade.charAt(0);
grad = Character.toUpperCase(grad);
while (grad != 'A' && grad != 'B' && grad != 'C' && grad != 'D' && grad != 'F')
{
strnGrade = JOptionPane.showInputDialog
("The grades for the course are invalid please enter the grade againg");
grad = strnGrade.charAt(0);
grad = Character.toUpperCase(grad);
}
System.out.println(grad);
}
}
Re: Char type Comparisson
I have marked this thread as solved :)
You can do this yourself in the 'Thread Tools' menu at the top.
Re: Char type Comparisson
thank you:)... i didn't know how to do it but now i know :-bd; and thanks again