number 65 in this case is used as Unicode value cuz A in unicode is 65,but the compiler reads it as a number.How is the right way to write a unicode value in this case?
if(x.charAt(0) >= 65 || x.charAt(0) <= 90 || x.charAt(0) >= 97 || x.charAt(0) <= 122){
if(x.charAt(0) == 'A' || x.charAt(0) == 'E' || x.charAt(0) == 'I' || x.charAt(0) == 'O' || x.charAt(0) == 'U' || x.charAt(0) == 'Y' ||
x.charAt(0) == 'a' || x.charAt(0) == 'e' || x.charAt(0) == 'i' || x.charAt(0) == 'o' ||x.charAt(0) == 'u' || x.charAt(0) == 'y'){
System.out.println("The character is a vowel!");
}else{
System.out.println("The character is a consonant!");
}
}else{
System.out.println("The character is not a letter!");
}
Aucun commentaire:
Enregistrer un commentaire