JAVA: String char removal with nested loop
I'm trying to make a nested loop which will search for and remove chars from a string. The keyword contains six letters, alphabet of course is 26. Can anyone show me what I'm doing wrong? The second loop works fine to remove one char, but I need it to remove all six, so that only the letters of the alphabet remain that are not in the keyword.
for (int j = 0; j < keyword.length(); j++)
letter = keyword.charAt(j);
for (int i = 0; i < alphabet.length(); i ++)
if (alphabet.charAt(i) != letter) r += alphabet.charAt(i);