Hello everybody I知 a beginner in java, and I知 having problems trying to compare character in my program.
I知 trying to have the user type a character and in the character it is not a correct one then tell the user to input the character again .
thank in advance here is the 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 Garde enter is invalid please enter the grade again"); } } }