I am doing a homework assignment for my Computer Science course. The task is to get a users input, remove all of the vowels, and then print the new statement.
I kno
Character.isLetter('a')
Character.isLetter(char) tells you if the value you give it is a letter, which isn't helpful in this case (you already know that "a" is a letter).
You probably want to use the equality operator, ==
, to see if your character is an "a", like:
char c = ...
if(c == 'a') {
...
} else if (c == 'e') {
...
}
You can get all of the characters in a String in multiple ways: