mercredi 18 avril 2018

Java using charAt() with || operator

I'm trying to check if there is a consonant in my String. There error i'm getting is: "Operator || cannot be applied to 'boolean','char'" Here is my code:

       for(int i=0;i<8;i++){
       if(bezeichnung.charAt(i) == 'b'||'c'||'d'||'f'||'g'||'h'||'j'||'k'||'l'||'m'||'n'||'p'||'q'||'r'||'s'||'t'||'v'||'w'||'x'||'y'||'z'){
        //do something
       }
    }

Aucun commentaire:

Enregistrer un commentaire